public async Task <ActionResult <int> > Delete([FromRoute] int id) { var res = await _productTypeRepo.DeleteProductType(id); if (res == 0) { return(NotFound()); } return(Ok(res)); }
public String DeleteProductType(String productTypeName) { try { _repository.DeleteProductType(productTypeName); return("{ \"isSuccess\" : true }"); } catch (Exception ex) { return("{ \"isSuccess\" : false," + "\"error_message\" : \"" + ex.Message + "\" }"); } }
public IActionResult Delete([FromODataUri] int productTypeId) { try { if (!_productTypeRepository.ProductTypeExists(productTypeId)) { return(NotFound()); } var userId = User.FindFirstValue(ClaimTypes.NameIdentifier); var profile = _accountRepository.GetUserProfile(userId); if (!_productTypeRepository.DeleteProductType(productTypeId, profile.UserProfileId)) { return(StatusCode(500, "A problem happened while handling your request.")); } return(NoContent()); } catch (Exception ex) { _logger.LogError($"Failed in Delete /ProductTypes(productTypeId): {ex}"); return(StatusCode(500, "A problem happened while handling your request.")); } }
public bool DeleteProductType(System.Int32 ProductTypeId) { return(_iProductTypeRepository.DeleteProductType(ProductTypeId)); }
public async Task <IActionResult> DeleteProductType(int id) { await _repository.DeleteProductType(id); return(Ok()); }