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