public ActionResult DeletePerdorues(string id) { using (var db = new taskDb()) { AspNetUsers model = new AspNetUsers(); model.Id = id; db.Entry(model).State = EntityState.Deleted; db.SaveChanges(); } return(RedirectToAction("Index")); }
public ActionResult SaveEditedPerdorues(PerdoruesViewModel model) { AspNetRoles roles = new AspNetRoles(); using (var db = new taskDb()) { db.AspNetUsers.Add(model.Users); db.Entry(model.Users).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); db.AspNetRoles.Where(a => a.Id == model.SelectedRole).FirstOrDefault().AspNetUsers.Add(model.Users); db.SaveChanges(); } return(RedirectToAction("Index")); }