示例#1
0
 public void DeleteTypes(string name)
 {
     if (name == null)
     {
         throw new BadRequestException("Type require a name.");
     }
     if (!_repository.TypeExist(name))
     {
         throw new NotFoundException($"Type with name {name} not found.");
     }
     try
     {
         _repository.DeleteTypes(_repository.GetTypesByName(name));
     }
     catch (Exception ex)
     {
         throw new BusinessException(ex.Message);
     }
 }
示例#2
0
        public IActionResult DeleteTypes(int id)
        {
            var responseData = _typesRepository.DeleteTypes(id);

            return(Json(new { response = responseData }));
        }