public async Task <IActionResult> Delete(int id) { var location = GetControllerActionNames(); try { _logger.LogInfo($"{location}: Delete Attempted on record with id: {id} "); if (id < 1) { _logger.LogWarn($"{location}: Delete failed with bad data - id: {id}"); return(BadRequest()); } var result = await _businessLogic.Delete(id); if (result.IsFailed) { return(InternalError($"{location}: Delete failed for record with id: {id}")); } _logger.LogInfo($"{location}: Record with id: {id} successfully deleted"); return(NoContent()); } catch (Exception e) { return(InternalError($"{location}: {e.Message} - {e.InnerException}")); } }
public IActionResult Delete([FromBody] Customer customer) { if (customer.Id > 0) { return(Ok(_logic.Delete(customer))); } return(BadRequest()); }
public IActionResult Delete([FromBody] Customer customer) { if (customer.Id > 0) { return(Ok(_logic.Delete(customer))); } return(BadRequest(new { Message = "Has ocurred during the customer deleted" })); }
public async Task <IActionResult> DeleteCustomer([FromRoute] int id) { try { await _customersLogic.Delete(id); return(Ok()); } catch (Exception ex) { return(BadRequest(ex.Message)); } }