public IActionResult Add(CatCreatingBindingModel model) { var cat = new Cat() { Name = model.Name, Age = model.Age, Breed = model.Breed, ImageUrl = model.ImageUrl }; this.Context.Cats.Add(cat); this.Context.SaveChanges(); return(RedirectToAction("Details", new { id = cat.Id })); }
public IActionResult Add(CatCreatingBindingModel model) { var cat = new Cat { Name = model.Name, Age = model.Age, Breed = model.Breed, ImageUrl = model.ImageUrl }; this.Context.Cats.Add(cat); this.Context.SaveChanges(); //return RedirectToRoute( // "default", // new { controller = "Cats", action = "Details", id = model.Id }); return(RedirectToAction("Details", new { id = cat.Id })); }