public IActionResult Delete(int?marketId) { try { if (!marketId.HasValue) { return(StatusCode(400, StatusCodes.ReturnStatusObject("No parameter provided."))); } var result = _marketRepository.Delete(marketId); if (result) { _logger.LogInformation($"ID : {marketId} has been successfully deleted."); return(StatusCode(200, StatusCodes.ReturnStatusObject($"ID : {marketId} has been successfully deleted."))); } else { _logger.LogError("Market ID : {0} was not deleted.", marketId); return(StatusCode(400, StatusCodes.ReturnStatusObject($"Delete was unsuccessful."))); } } catch (Exception e) { _logger.LogError("The Market delete has failed. Error - {0}", e.Message); return(StatusCode(400, StatusCodes.ReturnStatusObject("The delete has failed."))); } }
public int Delete(int id) { return(_market.Delete(id)); }