public ActionResult Delete(CharacterProfile profile) { string message = CharacterProfileRepository.DeleteCharacterProfile(profile); TempData["Message"] = message; return(RedirectToAction("Index")); // Route: CharacterProfile/Index }
public ActionResult Edit(CharacterProfile profile) { var editStatus = CharacterProfileRepository.UpdateCharacterProfile(profile); ViewBag.EditStatus = editStatus; return(View(profile)); }
public ActionResult NewCharacterProfile(string name, string description) //values in form { ViewBag.Name = name; //assigning values to ViewBag to re-fill the form. ViewBag.Description = description; CharacterProfileRepository.AddCharacterProfile(new CharacterProfile { Name = name, Description = description }); return(View()); }
public ActionResult Detail(int?id) { if (id == null || (int)id < 0) // if id is null or less than zero: { return(HttpNotFound()); } var characterProfile = CharacterProfileRepository.GetCharacterProfile((int)id); return(View(characterProfile)); }
public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } CharacterProfile profile = CharacterProfileRepository.GetCharacterProfile((int)id); if (profile == null) { return(HttpNotFound()); } return(View(profile)); }
//DONE: create edit method for the pre-send view-- i.e. the GET side of the equation public ActionResult Edit(int?id) { //TODO: Add try/catch handling, clean this up a bit if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } CharacterProfile profile = CharacterProfileRepository.GetCharacterProfile((int)id); if (profile == null) { return(HttpNotFound()); } return(View(profile)); }
public GetAccountsWithCharacters(IAccountRepository accountRepository, CharacterProfileRepository characterProfileRepository) { _accountRepository = accountRepository; _characterProfileRepository = characterProfileRepository; }
// GET: CharacterProfile public ActionResult Index() { var charProfileList = CharacterProfileRepository.GetCharacterProfiles(); return(View(charProfileList)); }