Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
 public IActionResult Create(Dog dog)
 {
     service.AddDog(dog);
     return(RedirectToAction(nameof(Index)));
 }