Edit Navigation

We have done with Edit page. Now, we want to do instructions when user pressed the edit button.

Do as we did with Add Action.

[HttpPost]
public ActionResult Edit(Entry entry)
{

}
  1. Now, we want to validate the entries for Duration segment. Perform the "extract method" features in VS.
  2. Then, we update the entry if the ModelState is in valid form.

    if (ModelState.IsValid)
    {
        _entriesRepository.UpdateEntry(entry);
    
        return RedirectToAction("Index");
    }
    
  3. Don't forget to populate the ListItem too.

PopulateSelectList();

a

results matching ""

    No results matching ""