Example #1
0
        public ActionResult <PetType> Delete(int id)
        {
            var petType = _petTypeService.DeletePetType(id);

            if (petType == null)
            {
                return(StatusCode(404, "did not find pettype with id " + id));
            }

            try
            {
                return(_petTypeService.DeletePetType(id));
            }
            catch (Exception g)
            {
                return(StatusCode(500, "Task F****d up"));
            }
        }
Example #2
0
        public ActionResult <PetType> Delete(int id)
        {
            var petType = _petTypeService.DeletePetType(id);

            if (petType == null)
            {
                return(StatusCode(404, "Did not find PetType with ID " + id));
            }

            try
            {
                return(_petTypeService.DeletePetType(id));
            }
            catch (Exception e)
            {
                return(StatusCode(500, "Task failed successfully"));
            }
        }
Example #3
0
 public ActionResult <PetType> Delete(int id)
 {
     try
     {
         return(Accepted(petTypeService.DeletePetType(id)));
     }
     catch (Exception e)
     {
         return(StatusCode(500, e.Message));
     }
 }
        public ActionResult <PetType> Delete(int id)
        {
            PetType deletedPetType;

            deletedPetType = _petTypeService.DeletePetType(id);
            if (deletedPetType == null)
            {
                return(StatusCode(404, "No owner with id " + id + " was found to delete "));
            }
            return(StatusCode(202, deletedPetType));
        }
Example #5
0
 public ActionResult <PetType> Delete(int id)
 {
     try
     {
         _petTypeService.DeletePetType(id);
         return(Accepted("The pet type with the id:" + id + "has been deleted"));
     }
     catch (Exception e)
     {
         return(NotFound(e.Message));
     }
 }
Example #6
0
 public ActionResult <string> Delete(int id)
 {
     try
     {
         _petTypeService.DeletePetType(id);
         return(Accepted($"Successfully deleted petType with the id {id}"));
     }
     catch (Exception e)
     {
         return(StatusCode(500, e.Message));
     }
 }
Example #7
0
        public ActionResult <PetType> Delete(int id)
        {
            var petType = _petTypeService.DeletePetType(id);

            if (petType == null)
            {
                return(StatusCode(404, "PetType not found"));
            }

            else
            {
                return(petType);
            }
        }
Example #8
0
 public ActionResult <PetType> Delete(int id)
 {
     try
     {
         var petType = _petTypeService.DeletePetType(id);
         return(StatusCode(202, petType));
     }
     catch (KeyNotFoundException e)
     {
         return(StatusCode(404, e.Message));
     }
     catch (Exception e)
     {
         return(StatusCode(500, e.Message));
     }
 }
Example #9
0
        public ActionResult <PetType> Delete(int id)
        {
            try
            {
                PetType typeDelete = _petTypeService.GetPetType(id);
                if (typeDelete == null)
                {
                    return(StatusCode(404, "could not find pet type to delete"));
                }

                return(StatusCode(202, _petTypeService.DeletePetType(id)));
            }
            catch (Exception ex)
            {
                return(StatusCode(500, ex.Message));
            }
        }
        public ActionResult <PetType> Delete(int id)
        {
            var petType = _petTypeService.DeletePetType(id);

            if (petType == null)
            {
                return(StatusCode(404, "PetType Id" + id + "Was not found"));
            }

            try
            {
                return(Ok(petType));
            }
            catch (Exception)
            {
                return(StatusCode(500, "Smth Went Wrong"));
            }
        }
Example #11
0
        public ActionResult <PetType> Delete(int id)
        {
            var deletePetType = _petTypeService.DeletePetType(id);

            if (deletePetType == null)
            {
                return(StatusCode(404, "Did not find Customer with ID " + id));
            }

            try
            {
                return(deletePetType);
            }
            catch (Exception e)
            {
                return(StatusCode(500, "something went wrong"));
            }
        }
Example #12
0
        public ActionResult <PetType> Delete(int id)
        {
            var deletePet = _petTypeService.DeletePetType(id);

            if (deletePet == null)
            {
                return(StatusCode(404, "Pet was not found"));
            }

            try
            {
                return(deletePet);
            }
            catch (Exception)
            {
                return(StatusCode(500, "Something went wrong"));
            }
        }
        public ActionResult <PetType> Delete(int id)
        {
            try
            {
                PetType petType = _petTypeService.DeletePetType(id);
                if (petType == null)
                {
                    return(StatusCode(404, "Could not find the petType with the specified id"));
                }


                return(StatusCode(202, petType));
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                return(StatusCode(404, e));
            }
        }
 public ActionResult <PetType> Delete(int id)
 {
     try
     {
         return(Ok(_petTypeService.DeletePetType(id)));
     }
     catch (InvalidDataException e)
     {
         return(BadRequest("Something went wrong with your request\n" + e.Message));
     }
     catch (KeyNotFoundException e)
     {
         return(NotFound("Could not find requested petType\n" + e.Message));
     }
     catch (DataBaseException e)
     {
         return(StatusCode(500, e.Message));
     }
 }
Example #15
0
        public ActionResult <PetType> DeleteByID(int ID)
        {
            if (PetTypeService.GetPetTypeByID(ID) == null)
            {
                return(NotFound("No pet type with such ID found"));
            }

            try
            {
                PetType petType = PetTypeService.DeletePetType(ID);
                return((petType != null) ? Accepted(petType) : StatusCode(500, $"Server error deleting pet type with Id: {ID}"));
            }

            catch (ArgumentException ex)
            {
                return(BadRequest(ex.Message));
            }
            catch (Exception ex)
            {
                return(StatusCode(500, $"Server error deleting pet type with Id: {ID}"));
            }
        }
Example #16
0
 public ActionResult <PetType> Delete(int id)
 {
     try
     {
         var petType = _petTypesService.DeletePetType(id);
         if (petType == null)
         {
             return(StatusCode(404, $"Did not find pet type with ID {id}"));
         }
         else
         {
             return(StatusCode(202, $"Pet type:\n{petType}\n\n...was successfully deleted"));
         }
     }
     catch (InvalidDataException e)
     {
         return(StatusCode(500, e.Message));
     }
     catch (Exception)
     {
         return(StatusCode(500, ExceptionMessageConstants.NonSpecificUIMessage));
     }
 }
Example #17
0
 public async Task <bool> DeletePetType(int petTypeId)
 {
     return(await _petTypeService.DeletePetType(petTypeId));
 }