public ActionResult Distribute(int?requestId, int?executorId) { if (requestId == null && executorId == null) { return(RedirectToAction("Distribute")); } Request req = db.Requests.Find(requestId); User ex = db.Users.Find(executorId); if (req == null && ex == null) { return(RedirectToAction("Distribute")); } req.ExecutorId = executorId; req.Status = (int)RequestStatus.Distributed; Lifecycle lifecycle = db.Lifecycles.Find(req.LifecycleId); lifecycle.Distributed = DateTime.Now; db.Entry(lifecycle).State = EntityState.Modified; db.Entry(req).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Distribute")); }
public ActionResult Edit(User user) { if (ModelState.IsValid) { db.Entry(user).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } SelectList departments = new SelectList(db.Departments, "Id", "Name"); ViewBag.Departments = departments; SelectList roles = new SelectList(db.Roles, "Id", "Name"); ViewBag.Roles = roles; return(View(user)); }