Ejemplo n.º 1
0
 public ActionResult <TypePet> Post([FromBody] TypePet typePet)
 {
     if (string.IsNullOrEmpty(typePet.Type))
     {
         BadRequest("invalid input");
     }
     _typePetService.Create(typePet);
     return(StatusCode(500, "typePet created successfully."));
 }
Ejemplo n.º 2
0
 public ActionResult <TypePet> Post([FromBody] TypePet typePet)
 {
     try
     {
         if (string.IsNullOrEmpty(typePet.Type))
         {
             BadRequest("Type Error! Check Type field.");
         }
         _typePetService.Create(typePet);
         return(StatusCode(202, "Yes Sir! Pet Type is created."));
     }
     catch (System.Exception)
     {
         return(StatusCode(500, "Error when creating pet type"));
     }
 }