asp.net-mvc-5

ASP.NET MVC - Better UX approach to allowing child object editing than For loop and Partial Views

杀马特。学长 韩版系。学妹 提交于 2019-12-12 22:21:02
问题 I have a Contact object that has a number properties, including a child that is a list of Addresses. public class Contact { public int? Id { get; set; } public string Name { get; set; } public IReadOnlyList<IAddress> Addresses { [Lazy Load Code to populate and return list] } [...] } I want to allow the user to edit the addresses without having to edit (or post) the whole Contact object. Currently in the UI I have the addresses listed out with an Edit button next each one: I'm using the Modal

Is the asp.net mvc 5 sample project with 2 factor authentication a sample or production ready?

烈酒焚心 提交于 2019-12-12 20:11:58
问题 It seems like the only way I can currently get 2 factor authentication from identity 2 is if I create an empty MVC 5 app then install the Identity samples Pre release with the package manager like so: Install-Package -Prerelease Microsoft.AspNet.Identity.Samples But it seems like this is only a sample and not something I can use for a real app? Can I use this "sample" project as a real app? It says in the documentation at www.asp.net/identity that it is a production release! I just want to

Where is class library (package) in VS 2015?

▼魔方 西西 提交于 2019-12-12 19:14:29
问题 I'm trying to add a class library (package) to my ASP.NET MVC 5 project. But I cannot find the option for some reason. Is there some other dependency I have to install to get the option? 回答1: It's now called "Class Library (.NET Core)". 来源: https://stackoverflow.com/questions/40952467/where-is-class-library-package-in-vs-2015

Where to store OAUTH2 access token in mvc5 web app

心不动则不痛 提交于 2019-12-12 18:32:56
问题 I have an API (.net web api 2) that is to be consumed by a (external) mvc5 application. The API implements a simple authorization server for issuing tokens to consumers (The implementation follows the example given by thinktecture identitymodel samples). The API is to be consumed by (among others) users of a GUI (mvc5 application) which have to log in to gain access to the application. When logging in, a http request is issued by the application to the API which in the case of correct

mvc 5 error handling not working after third folder

我们两清 提交于 2019-12-12 17:45:03
问题 I have an MVC 5 app and with custom errors defined in web.config : <customErrors mode="RemoteOnly" redirectMode="ResponseRedirect" defaultRedirect="~/Errors/GeneralError"> <error statusCode="404" redirect="~/Errors/NotFound" /> <error statusCode="500" redirect="~/Errors/ServerError" /> </customErrors> if I type a none existing url it will handle it just fine as long as it is 3 levels/folders maximum. I also have Elmah installed and it will log the error. On the other hand, if I try accessing

show/hide elements dynamically using knockout

时光怂恿深爱的人放手 提交于 2019-12-12 17:16:17
问题 I have a table which has four columns namely Code, Name, Quantity and Price. Out of these, I want to change the content/element of Quantity column dynamically. Normally, it should show the element with quantity displayed in it and when user click on element, I want to show the element so user can edit the quantity. I'm trying to implement as per "Example 2" on this knockout documentation link. Following is my code : Page Viewmodel function OrderVM (vm) { var self = this; self.OrderNo= ko

Building/Bundling an Angular 2 application for a .NET MVC project

给你一囗甜甜゛ 提交于 2019-12-12 17:11:36
问题 I currently have an angular '2' application inside of a .NET 4.6 project. It is working nicely however I have question with regards to bundling. The application was created using the latest angular CLI and I have a preference to building/bundling the application with it. The bundle's webpack creates are fantastic from my experience. My question to you is do you have any recommendations/idea's with regards to bundling and thus consuming this bundle in a .NET MVC application? I have seen some

Issues after installing ninject mvc 3 in mvc 5 project

元气小坏坏 提交于 2019-12-12 13:19:22
问题 I have created new asp mvc 5 project. Project target .NET 4.5. I installed ninject mvc 3 nuget package. But when I run project I get this error in NinjectWebCommon.cs in CreateKernel() method: An exception of type 'System.IO.FileLoadException' occurred in Ninject.dll but was not handled in user code Additional information: Could not load file or assembly 'System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's

How to retrieve multiple columns from non-entity type sql query?

有些话、适合烂在心里 提交于 2019-12-12 13:12:23
问题 I have a view in database with several columns. I am trying this query public class TestEntity { public string ref { get; set; } public string Name { get; set; } public string Batch { get; set; } } var res = dbContext.Database.SqlQuery<TestEntity>("Select * from dbo.MyView").ToList(); but this returns list of objects with only null values and no data. However, when I try to retrieve single column like this it works var res = dbContext.Database.SqlQuery<string>("Select Name from dbo.MyView")

ASP .NET MVC 5 - Customer-Address One-To-One relationship

核能气质少年 提交于 2019-12-12 12:55:36
问题 I've looked into forums here and actually found some similar questions, but not the same ones. Similar solutions did not give me the right answer. I'm working with ASP .NET MVC 5 using Entity Framework and Code First approach. I would like to model Customer -> Address One-To-One relationship. What I've modeled is: Customer class public class Customer { public int Id { get; set; } public string Name { get; set; } [DisplayName("Middle Name")] public string MiddleName { get; set; } [DisplayName(