public ActionResult Edit(Entry entry) { //validate the entry ValidateEntry(entry); //if the entry is valid // 1) Use te repository to update the entry // 2) Redirect the user to the "Entries" List page if (ModelState.IsValid) { _entriesRepository.UpdateEntry(entry); TempData["Message"] = "Your entry was successfully edited!"; return(RedirectToAction("Index")); } //Todo populate the activities select list items ViewBag property SetupActivitiesSelectListItems(); return(View(entry)); }
public ActionResult Edit(Entry entry) { //TODO Validate the entry ValidateEntry(entry); //TODO if the entry is valid... //1. Use the repo to update the entry //2. Redirect the user to the "Entrie" list page if (ModelState.IsValid) { _entriesRepository.UpdateEntry(entry); TempData["Message"] = "Your entry was successfully updated!"; return RedirectToAction("Index"); } //TODO Populate the activites select list items ViewBag SetupActivitieSelectListItems(); return View(entry); }
public ActionResult Edit(Entry entry) { //TODO validate the entry ValidateEntry(entry); //TODO if entry is valid: //1. Use the repository to update the entry //2. Redirect the user to the Entries list page if (ModelState.IsValid) { _entriesRepository.UpdateEntry(entry); TempData["Message"] = "Edited"; return(RedirectToAction("Index")); } //TODO populate the activities select list items ViewBag property SetupActivitiesSelectListItems(); return(View(entry)); }
public ActionResult Edit(Entry entry) { // validate the entry ValidateEntry(entry); // if the entry is valid if (ModelState.IsValid) { // Use the repository to update the entry _entriesRepository.UpdateEntry(entry); TempData["Message"] = "Your entry was succesfully updated!"; // Redirect the user to the 'Entries' list page return(RedirectToAction("Index")); } SetupActivitiesSelectListItems(); return(View(entry)); }
public ActionResult Edit(Entry entry) { //Validate entry ValidateEntry(entry); //If entry is valid if (ModelState.IsValid) { //Use repository to update entry _entriesRepository.UpdateEntry(entry); TempData["Message"] = "Your entry was successfully edited!"; //Redirect user to Entries list page return(RedirectToAction("Index")); } //Populate activities select list items ViewBag property SetupActivitiesSelectListItems(); return(View(entry)); }
public ActionResult Edit(Entry entry) { //todo validate the entry ValidateEntry(entry); // todo if the entry is valid //1) use the repository to update the entry //2) redirect the user to the entries list page if (ModelState.IsValid == true) { _entriesRepository.UpdateEntry(entry); TempData["Message"] = "Your entry was successfully updated!"; return(RedirectToAction("Index")); } SetupActivitiesSelectListItems(); return(View(entry)); }
public ActionResult Edit(Entry entry) { /* Validate the entry */ ValidateEntry(entry); /* If the entry is valid... */ /* 1) Use the repository to update the entry */ /* 2) Redirect the user to the "Entries" list page */ if (ModelState.IsValid) { _entriesRepository.UpdateEntry(entry); /* Confirmation message after an entry has being updated */ TempData["Message"] = "Your entry was successfully updated!"; return(RedirectToAction("Index")); } /* Populate the activities select list items ViewBag property */ SetupActivitiesSelectListItems(); return(View(entry)); }