public IActionResult Create(CustomerForModel model) { if (!ModelState.IsValid) { return(View(model)); } this.customers.Create(model.Name, model.BirthDay, model.IsYoungDriver); return(RedirectToAction(nameof(All), new { order = OrderType.Ascending.ToString() })); }
public IActionResult Edit(int id, CustomerForModel model) { if (!ModelState.IsValid) { return(View(model)); } var customerExist = this.customers.Exists(id); if (!customerExist) { return(NotFound()); } this.customers.Edit( id, model.Name, model.BirthDay, model.IsYoungDriver); return(RedirectToAction(nameof(All), new { order = OrderType.Ascending })); }