asp.net-mvc-5

How to resolve error 500 on Azure web app?

随声附和 提交于 2021-02-07 04:48:14
问题 What I have: VS2015U2 ASP.NET 5 MVC 6 website Deployed to Azure Web App The site works locally When I deploy to Azure I get internal server error (500) I'm unable to Attach a debugger since they messed up something with the latest versions (tried manually too https://azure.microsoft.com/en-us/blog/introduction-to-remote-debugging-on-azure-web-sites/) I have app.UseDeveloperExceptionPage(); but I guess the site is failing during configuration so it doesn't display any other information. So how

Route Id overrides Model.Id

佐手、 提交于 2021-02-07 03:54:34
问题 I have a route like this: Conference/Committees/1 And within that page, it cycles through the Committees for a Conference (where the Conference Id = 1). I have a partial view that renders an edit style page for a selected committee, with a route like this: Conference/Committees/1?committeeId=2 In debug, the model data is correct, and the Committee has an Id = 2. However, when I use the following Razor statement: @Html.HiddenFor(model => model.Id) with the following model: @model munhq.Models

Route Id overrides Model.Id

筅森魡賤 提交于 2021-02-07 03:48:00
问题 I have a route like this: Conference/Committees/1 And within that page, it cycles through the Committees for a Conference (where the Conference Id = 1). I have a partial view that renders an edit style page for a selected committee, with a route like this: Conference/Committees/1?committeeId=2 In debug, the model data is correct, and the Committee has an Id = 2. However, when I use the following Razor statement: @Html.HiddenFor(model => model.Id) with the following model: @model munhq.Models

Route Id overrides Model.Id

久未见 提交于 2021-02-07 03:46:35
问题 I have a route like this: Conference/Committees/1 And within that page, it cycles through the Committees for a Conference (where the Conference Id = 1). I have a partial view that renders an edit style page for a selected committee, with a route like this: Conference/Committees/1?committeeId=2 In debug, the model data is correct, and the Committee has an Id = 2. However, when I use the following Razor statement: @Html.HiddenFor(model => model.Id) with the following model: @model munhq.Models

Route Id overrides Model.Id

杀马特。学长 韩版系。学妹 提交于 2021-02-07 03:45:40
问题 I have a route like this: Conference/Committees/1 And within that page, it cycles through the Committees for a Conference (where the Conference Id = 1). I have a partial view that renders an edit style page for a selected committee, with a route like this: Conference/Committees/1?committeeId=2 In debug, the model data is correct, and the Committee has an Id = 2. However, when I use the following Razor statement: @Html.HiddenFor(model => model.Id) with the following model: @model munhq.Models

MVC 5 IsInRole Usage on Razor Views: Cannot connect to Database

人盡茶涼 提交于 2021-02-06 10:12:37
问题 I'm having issues using the new identity system in MVC 5, my goal is to make use of the User.IsinRole("RoleName") on Views. For example: @if(User.IsInRole("Administrator")) { <li>@Html.ActionLink("Admin", "Index", "Admin")</li> } This is placed in the main layout page which is hit when the application launches. On doing this, i'm getting the following error: "An exception of type 'System.Web.HttpException' occurred in System.Web.dll but was not handled in user code Additional information:

In MVC 5 how to pass table Object data as a list to Controller View Model?

这一生的挚爱 提交于 2021-01-29 20:16:23
问题 My Controller ItemRequestViewModel is null & the issue is it didn't pass any value from view to controller but when i pass a List<string> it shows one Row Value. I just can't pass multiple object to Controllers ViewModel. i have tried by passing as a List<ItemRequestViewModel reqItem> as well but it seems no hope. My Controller public ActionResult ReqNotifyApprove(List<ItemRequestViewModel> reqItem) { return null; } My View @model IEnumerable<Management_System.ViewModels.ItemRequestViewModel>

How to simplify conditional Lambda using Switch

南楼画角 提交于 2021-01-29 07:37:21
问题 Somebody that could point me into the right direction in order to simplify the following code using switch statement? var indicators = db.Sses .GroupBy(x => x.Estado) .Select(x => new IndicatorViewModel { Count = x.Count(), IndicatorType = x.Key.ToString(), IndicatorClass = EstadoServicio.Nuevo == x.Key ? "bg-red" : (EstadoServicio.Proceso == x.Key ? "bg-yellow" : (EstadoServicio.Aprobación == x.Key ? "bg-aqua" : "bg-green")) , IconClass = EstadoServicio.Nuevo == x.Key ? "fa-bookmark-o" :

How to simplify conditional Lambda using Switch

浪子不回头ぞ 提交于 2021-01-29 07:30:24
问题 Somebody that could point me into the right direction in order to simplify the following code using switch statement? var indicators = db.Sses .GroupBy(x => x.Estado) .Select(x => new IndicatorViewModel { Count = x.Count(), IndicatorType = x.Key.ToString(), IndicatorClass = EstadoServicio.Nuevo == x.Key ? "bg-red" : (EstadoServicio.Proceso == x.Key ? "bg-yellow" : (EstadoServicio.Aprobación == x.Key ? "bg-aqua" : "bg-green")) , IconClass = EstadoServicio.Nuevo == x.Key ? "fa-bookmark-o" :

How to Inject dependencies in a Unity IoC container for SignalR hub?

折月煮酒 提交于 2021-01-27 14:41:55
问题 I have an application that is written with c# on the top of the ASP.NET MVC 5 Framework. I implemented Unity.Mvc into my project. Now, I am trying to inject dependencies objects into my SignalR Hub. I created a class called UnityHubActivator My class looks like this public class UnityHubActivator : IHubActivator { private readonly IUnityContainer _container; public UnityHubActivator(IUnityContainer container) { _container = container; } public IHub Create(HubDescriptor descriptor) { return