Example #1
0
        public async Task <bool> Handle(DeleteDeliveryCommand message, CancellationToken cancellationToken)
        {
            var delivery = await _deliveryRepository.GetAsync(message.DeliveryId);

            if (delivery == null)
            {
                return(false);
            }

            _logger.LogInformation("----- Deleting Delivery: {@DeliveryLocation}", delivery);

            _deliveryRepository.Delete(delivery);

            return(await _deliveryRepository.UnitOfWork.SaveEntitiesAsync(cancellationToken));
        }
        public Task <bool> Delete(IExecutionContext executionContext, string id)
        {
            AssertExecutionContext(executionContext);
            if (executionContext.UserRole != Role.User)
            {
                throw new UnauthorizedException("Only user can delete delivery");
            }

            if (id == null)
            {
                throw new ArgumentNullException(nameof(id));
            }

            return(_deliveryRepo.Delete(id));
        }
 public IActionResult DeleteConfirmed(int id)
 {
     _deliveryrepository.Delete(id);
     return(RedirectToAction(nameof(Index)));
 }
Example #4
0
 public void Delete(string id)
 {
     Repo.Delete(new Guid(id));
 }
Example #5
0
 public async Task <Delivery> delete(int id) => await _repository.Delete(id);
        public void DeleteDelivery(long deliveryId)
        {
            var delivery = _deliveryRepository.GetById(deliveryId);

            _deliveryRepository.Delete(delivery);
        }
Example #7
0
        public int DelDelivery(string ids)
        {
            int i = _deliveryRepository.Delete(ids);

            return(i);
        }