public string AddDog(Dog Dog) { string jsonResponse; try { _dogService.AddDog(Dog); jsonResponse = $"Dog created succesfully. Details: {Dog.Name}, {Dog.FavouriteThing}, {Dog.WouldLike}"; } catch (Exception e) { jsonResponse = $"Error creating dog: {e.Message}"; } return(jsonResponse); }
public IActionResult Create(Dog dog) { service.AddDog(dog); return(RedirectToAction(nameof(Index))); }