public ActionResult Create(Achievement achievement) { if(ModelState.IsValid) { achievement.Id = Guid.NewGuid(); this.db.Achievements.Add(achievement); this.db.SaveChanges(); return RedirectToAction("Index"); } if(this.account.IsUserAdmin(this.account.GetLoggedInUserId())) { return View(achievement); } else { return RedirectToAction("Dashboard", "Home"); } }
public ActionResult Edit(Achievement achievement) { if(ModelState.IsValid) { this.db.Entry(achievement).State = EntityState.Modified; this.db.SaveChanges(); return RedirectToAction("Index"); } if(this.account.IsUserAdmin(this.account.GetLoggedInUserId())) { return View(achievement); } else { return RedirectToAction("Dashboard", "Home"); } }