// 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")); } }
public ActionResult Delete(int id, UserCharacterBO uChar) { try { // TODO: Add delete logic here using (BLLContext ctx = new BLLContext()) { ctx.DeleteUserCharacter(id); return(RedirectToAction("Personal")); } } catch (Exception ex) { Logger.Log(ex); return(View("Error", ex)); } }
// 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")); } }