public IActionResult Create(Restaurent restaurent) { if (ModelState.IsValid) { restaurent = _restaurent.Add(restaurent); return(RedirectToAction(nameof(Details), new { id = restaurent.Id })); } else { return(View()); } }
public IActionResult Create(EditRestaurentViewModel restaurent) { if (ModelState.IsValid) { Restaurent aRestaurent = new Restaurent(); aRestaurent.Name = restaurent.Name; aRestaurent.Type = restaurent.Type; _restaurentData.Add(aRestaurent); return(RedirectToAction("Details", new { id = aRestaurent.Id })); } return(View()); }