public ActionResult EditClient(Clients model) { if (ModelState.IsValid) { //var client = new Clients //{ // ID =model.ID, // ClientName = model.ClientName, // BuildingCount = model.BuildingCount //}; model.BuildingCount = 0; db.Clients.Attach(model); var Entry = db.Entry(model); Entry.Property(c => c.ClientName).IsModified = true; Entry.Property(c => c.Address).IsModified = true; Entry.Property(c => c.City).IsModified = true; Entry.Property(c => c.State).IsModified = true; Entry.Property(c => c.Phone).IsModified = true; Entry.Property(c => c.Fax).IsModified = true; Entry.Property(c => c.Email).IsModified = true; Entry.Property(c => c.BuildingCount).IsModified = true; db.SaveChanges(); } return(RedirectToAction("ClientIndex")); }
public async Task <ActionResult> Edit([Bind(Include = "ID,FirstName,LastName,Phone,Username,Password,Created,isTemPWord,aptID,LogintableID")] Tenant tenant) { if (ModelState.IsValid) { db.Entry(tenant).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } ViewBag.aptID = new SelectList(db.Apartment, "ID", "ApartmentNumber", tenant.aptID); return(View(tenant)); }
public ActionResult Edit([Bind(Include = "UserID,RoleID")] Role role) { if (ModelState.IsValid) { db.Entry(role).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.UserID = new SelectList(db.AspNetRoles, "Id", "Name", role.UserID); ViewBag.UserID = new SelectList(db.AspNetUsers, "Id", "Email", role.UserID); return(View(role)); }
public ActionResult BuildingRequestHistoryEdit(int RequestID, int BuildingID) { Requests request = db.Requests.Find(RequestID); db.Requests.Attach(request); var Entry = db.Entry(request); Entry.Property(c => c.Description).IsModified = true; Entry.Property(c => c.PIN).IsModified = true; Entry.Property(c => c.RequestType).IsModified = true; Entry.Property(c => c.ToDate).IsModified = true; Entry.Property(c => c.FromDate).IsModified = true; db.SaveChanges(); return(RedirectToAction("BuildingRequestHistoryIndex", new { BuildingID = BuildingID })); }