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); } }
public IActionResult DeleteTypes(int id) { var responseData = _typesRepository.DeleteTypes(id); return(Json(new { response = responseData })); }