asp.net-mvc-5

How to implement a Unit of work containing the new IdentityUser

牧云@^-^@ 提交于 2020-01-22 22:38:08
问题 I am wondering what is the best way to add the UserManager to my Unit of work. Should I use the IUstrore interface and add a new UserManager in my controller? Should I just use UserManager in my UnitOfWork or should I do something different? Here is two ideas I had for my unit of work and controller implementation. public class UnitOfWorkPds : IUnitOfWorkPds, IDisposable { private ApplicationDbContext context = new ApplicationDbContext(); private IUserStore<ApplicationUser> userStore; public

The controller for path … was not found or does not implement IController

笑着哭i 提交于 2020-01-21 09:20:12
问题 I am writing an application using ASP.NET MVC 5 using c#. I have a need to add a global menu on the upper right hand side of the application. I was advised other SO to use action with ChildActionOnly attribute. So here is what I have done. I created a BaseController like this public class BaseController : Controller { [ChildActionOnly] public ActionResult ClientsMenu() { using (SomeContext db = new SomeContext()) { return PartialView(db.Database.SqlQuery<Client>("SELECT * FROM clients")

The controller for path … was not found or does not implement IController

£可爱£侵袭症+ 提交于 2020-01-21 09:18:47
问题 I am writing an application using ASP.NET MVC 5 using c#. I have a need to add a global menu on the upper right hand side of the application. I was advised other SO to use action with ChildActionOnly attribute. So here is what I have done. I created a BaseController like this public class BaseController : Controller { [ChildActionOnly] public ActionResult ClientsMenu() { using (SomeContext db = new SomeContext()) { return PartialView(db.Database.SqlQuery<Client>("SELECT * FROM clients")

Load partial view in main view on click

谁都会走 提交于 2020-01-21 08:55:54
问题 I'm trying to get a partial view to load on my current view when the user clicks the link but it keeps loading the partial view rather then on the same view. Not sure what I'm missing. Main View Controller public PartialViewResult MonitorDetail(MonitorType mType) { return PartialView("MonitorDetail", mType); } Main View <script src="~/Scripts/jquery-2.1.1.js"></script> <script src="~/Scripts/jquery.unobtrusive-ajax.js"></script> <p class="lbutton radius"> @Ajax.ActionLink("SQL Cluster Online

Understanding Asp.Net Identity key points

ぃ、小莉子 提交于 2020-01-21 08:16:23
问题 I am an Asp.net developer but very much new to the Asp.net Identity framework. I have been studying the sample application and followed some tutorials too on Identity but still I am not able to grasp the concept completely. I have very firm grip over Asp.net membership but Identity seems nothing like membership. I will explain what I have done so far. I am creating a simple application in which I am following code first approach. I have created entity model for User which inherits from

How to save Rotativa PDF on server

本秂侑毒 提交于 2020-01-21 01:41:28
问题 I am using Rotativa to generate PDF in my "MVC" application. How can I save Rotativa PDF? I need to save the document on a server after all the process is completed. Code below: public ActionResult PRVRequestPdf(string refnum,string emid) { var prv = functions.getprvrequest(refnum, emid); return View(prv); } public ActionResult PDFPRVRequest() { var prv = Session["PRV"] as PRVRequestModel; byte[] pdfByteArray = Rotativa.WkhtmltopdfDriver.ConvertHtml("Rotativa", "Approver", "PRVRequestPdf");

Setup OWIN dynamically (by domain)

做~自己de王妃 提交于 2020-01-20 04:57:25
问题 We are trying to setup a white label on our project that uses OWIN(includes FB, google, Live logins). Is there a way to setup their API credential dynamically, say if they changes the domain the settings will change. I think owin loads earlier than MVC? Is there a way that we can load it on Global.asax(Request)? public partial class Startup { public void Configuration(IAppBuilder app) { ConfigureAuth(app); } } UPDATE: In other words a single Application will host many domains and sub domains

“There was an error running the selected code generator” in VS 2013 scaffolding

≡放荡痞女 提交于 2020-01-18 04:28:18
问题 I'm creating a new view off of a model. The error message I am getting is Error There was an error running the selected code generator: 'Access to the path 'C:\Users\XXXXXXX\AppData\Local\Temp\SOMEGUID\EntityFramework.dll' is denied'. I am running VS 2013 as administrator. I looked at Is MvcScaffolding compatible with VS 2013 RC by command line? but this didn't seem to resolve the issue. VS2013 C#5 MVC5 Brand new project started in VS 2013. 回答1: VS2013 Error: There was an error running the

Database schema for managing addresses

不问归期 提交于 2020-01-17 14:47:25
问题 I am developing a MVC project with sql server. in which each user will be given a username after registration. Registration is done using various data like address and email number and phone number. I am using a table to store address and its id is stored in users table. Now as people can have change address so I'm not able to understand it how to manage it. I want to keep the old address as well as new for new users. Can anybody help? 回答1: You have some options: In address table, add userid

ASP.NET MVC 5, how to enable validation annotation on viewmodel that composes other view models?

末鹿安然 提交于 2020-01-17 11:15:51
问题 Well I have a very complex User Profile system in a social network application I am building. The profile page has tabs that distinguishes each category of user profile information: Basic, Education, Job. There is a UserProfileViewModel sitting on top of everything, which composes of inner view models such as BasicViewModel, EducationViewModel and JobViewModel. Consider the structure as below: public class ProfileViewModel { public string id { get; set; } public BasicViewModel basic { get;