public void Update(int id) { estatesnEntities ee = new estatesnEntities(); SiteUser u = (from user in ee.SiteUser where user.UserID == id select user).First <SiteUser>(); u.FIO = Request.Form["FIO"]; u.Country.CountryID = int.Parse(Request.Form["CountryID"]); ee.SaveChanges(); RedirectToAction(new { Action = "Edit", ID = u.UserID }); }
public void Create(string userName, string email, string password1, string password2) { SiteUser u = new SiteUser(); u.UserName = userName; u.EMail = email; u.Password = password1; estatesnEntities ee = new estatesnEntities(); ee.AddToSiteUser(u); ee.SaveChanges(); if (Membership.CreateUser(userName, password1, email) == null) { throw new MembershipCreateUserException("An unspecified error occurred."); } FormsAuthentication.SetAuthCookie(userName, true); Response.Redirect("/"); }