// GET: UserCharacter/Edit/5 public ActionResult Edit(int id) { using (BLLContext ctx = new BLLContext()) { UserCharacterBO character = ctx.GetUserCharacter(id); UserBO user = ctx.GetUserByID(character.UserID_FK); if ((user.UserName == User.Identity.Name) || User.IsInRole("Moderator") || User.IsInRole("Administrator")) { return(View(character)); } TempData["message"] = "This ain't your personalized character."; return(RedirectToAction("Login", "Home")); } }
// GET: UserCharacter/Delete/5 public ActionResult Delete(int id) { using (BLLContext ctx = new BLLContext()) { //UserCharacterBO uChar = ctx.GetUserCharacter(id); //return View(uChar); UserCharacterBO character = ctx.GetUserCharacter(id); if (character != null) { UserBO user = ctx.GetUserByID(character.UserID_FK); if ((user.UserName == User.Identity.Name) || User.IsInRole("Moderator") || User.IsInRole("Administrator")) { return(View(character)); } // need to finish logic to send message that user isn't this user TempData.Remove("Message"); TempData["Message"] = "This ain't your personalized character."; return(RedirectToAction("Login", "Home")); } return(View("Error")); } }