Пример #1
0
        public Shipper RemoveShipper(int id)
        {
            var res = shipperRepository.Get(id);

            shipperRepository.Remove(res);
            return(res);
        }
Пример #2
0
        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());
     }
 }
Пример #4
0
        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);
        }