public async Task <IActionResult> DeletePie(Guid id) { if (id == null || id == Guid.Empty) { return(BadRequest()); } var pieToDelete = await _pieService.GetPieById(id); if (pieToDelete == null) { return(NotFound()); } await _pieService.DeletePie(id); return(NoContent());//success }
public void DeletePie(Guid id) { try { Pie pieToDelete = _pieService.GetPieById(id); if (pieToDelete != null) { _pieService.DeletePie(id); } else { throw new FaultException("Pie doesn't exist"); } } catch (Exception ex) { throw new FaultException("Something went wrong: " + ex.Message); } }
public void DeletePie(Guid id) { try { Pie pieToDelete = _pieService.GetPieById(id); if (pieToDelete != null) { _pieService.DeletePie(id); } else { throw new SoapException("Pie doesn't exist", SoapException.ClientFaultCode); } } catch (Exception ex) { throw new SoapException("Something went wrong", SoapException.ServerFaultCode, ex); } }