I hope i’m not bithering with my many questions…
i’m creating users in the ASPNETDB.MDF database with the asp.net configuration.
i have a client MVC, and i want when a client is created, edited, or deleted, it must dispaly the user_name and last_user_name of the user that performed the action. These two properties r in the client model. i want my controller to only deal with the ID(PK) of the users, and not their names. I only know how to make the controller work with the user names. How do i ensure that any functionality is done with the id but the display is the user_name? Here is my create method in my clientcontroller
[Authorize]
public ActionResult Create()
{
var model = new title
{
create_dt = DateTime.Now,
last_maint_dt = DateTime.Now,
row_version = 1,
status = "ACTIVE",
user_id = System.Web.HttpContext.Current.User.Identity.Name,
last_user_id = System.Web.HttpContext.Current.User.Identity.Name
};
return View(model);
}
If you are using the default ASP.NET Membership Provider you can find the user GUID for an account by accessing
System.Web.Security.Membership. Then you can use the GetUser() method and pass it the username as an argument.And if you have the GUID and want the Username