private void UpdateDBChangesLock(Object entity) { lock (obj) { db.Entry(entity).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); } }
public ActionResult Edit([Bind(Include = "Id,FullName,Email,Role,IsDeleted,CompanyCode,CreationDate")] User user) { if (ModelState.IsValid) { db.Entry(user).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.CompanyCode = new SelectList(db.Companies, "Code", "Name", user.CompanyCode); return(View(user)); }
public ActionResult Edit([Bind(Include = "Id,Content,CreationDate,UserId,ExecutionId")] Comment comment) { if (ModelState.IsValid) { db.Entry(comment).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.ExecutionId = new SelectList(db.Executions, "Id", "MachineIP", comment.ExecutionId); ViewBag.UserId = new SelectList(db.Users, "Id", "FullName", comment.UserId); return(View(comment)); }
public ActionResult Edit([Bind(Include = "IP,VLan,IsDeleted,CompanyCode,CreationDate,CountryId")] Machine machine) { if (ModelState.IsValid) { db.Entry(machine).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.CompanyCode = new SelectList(db.Companies, "Code", "Name", machine.CompanyCode); ViewBag.CountryId = new SelectList(db.Countries, "Id", "Name", machine.CountryId); return(View(machine)); }
public ActionResult Edit([Bind(Include = "Id,CreationDate,Status,SrartTime,EndTime,ScheduleTime,UserId,ReasonId,MachineVLan,MachineIP")] Execution execution) { if (ModelState.IsValid) { db.Entry(execution).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.MachineIP = new SelectList(db.Machines, "IP", "IP", execution.MachineIP); ViewBag.ReasonId = new SelectList(db.Reasons, "Id", "ReasonName", execution.ReasonId); ViewBag.UserId = new SelectList(db.Users, "Id", "FullName", execution.UserId); return(View(execution)); }
public ActionResult Edit([Bind(Include = "Code,Name,Logo")] Company company) { if (ModelState.IsValid) { db.Entry(company).State = EntityState.Modified; db.SaveChanges(); ViewBag.ModelName = "Company"; ViewBag.ItemName = company.Name; return(PartialView("SuccessPage")); } return(PartialView(company)); }