public void SaveEditUser(BusinessObjects.User User) { Logger.TraceMethodStart(ClassName, "SaveEditUser"); using (var db = new EntityModel.BugTrackingEntities()) { using (var transaction = db.Database.BeginTransaction()) { try { User.LastModified = DateTime.Now; var resp = MapperAllLevels.Map <BusinessObjects.User, EntityModel.User>(User); db.Entry(resp).State = EntityState.Modified; db.SaveChanges(); transaction.Commit(); } catch (Exception ex) { Logger.TraceError("Exception: ", ex); transaction.Rollback(); } finally { Logger.TraceMethodEnd(ClassName, "SaveEditUser"); } } } }
public ActionResult EditUser([Bind(Include = "ID,FirstName,LastName,Email,UserName, Active, LastModified, OrganizationID, TelephoneNumber, UserId")] BusinessObjects.User user) { usermanager.SaveEditUser(user); return(RedirectToAction("/UserList")); }