public Shipper RemoveShipper(int id) { var res = shipperRepository.Get(id); shipperRepository.Remove(res); return(res); }
public async Task <ActionResult <Shipper> > DeleteShipper([FromRoute] int id) { var shipper = await _shipperRepository.Find(id); if (shipper == null) { return(NotFound()); } await _shipperRepository.Remove(id); return(Ok(shipper)); }
public IActionResult Delete(Guid id) { if (ModelState.IsValid) { _logger.LogInformation("Shipper Deleted" + " " + id + " " + DateTime.Now.ToString()); _repository.Remove(_repository.GetById(id)); return(RedirectToAction("List")); } else { _logger.LogError("Shipper Delete Action Failed" + " " + DateTime.Now.ToString()); return(BadRequest()); } }
public RemoveShipperResponse RemoveShipper(RemoveShipperRequest request) { RemoveShipperResponse response = new RemoveShipperResponse(); response.Errors = new List <BusinessRule>(); try { if (_shipperRepository.Remove(request.ShipperID) > 0) { response.ShipperDeleted = true; } } catch (Exception ex) { response.Errors.Add(new BusinessRule("DAL", "DAL_ERROR: " + ex.Message)); } return(response); }