public ActionResult Approve(int?postId) { if (postId == null) { return(RedirectToAction("Approve")); } Post post = db.Posts.Find(postId); if (post == null) { return(RedirectToAction("Approve")); } post.Status = (int)PostStatus.Approved; Lifecycle lifecycle = db.Lifecycles.Find(post.LifecycleId); lifecycle.Approved = DateTime.Now; db.Entry(lifecycle).State = EntityState.Modified; db.Entry(post).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Approve")); }
public ActionResult Edit(User user) { if (ModelState.IsValid) { db.Entry(user).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } SelectList roles = new SelectList(db.Roles, "Id", "Name"); ViewBag.Roles = roles; return(View(user)); }