public void Delete(string[] ids)
        {
            using (var repository = _subscriptionRepositoryFactory())
            {
                //Remove subscription order prototypes
                var orderPrototypesIds = repository.Subscriptions.Where(x => ids.Contains(x.Id)).Select(x => x.CustomerOrderPrototypeId).ToArray();
                _customerOrderService.Delete(orderPrototypesIds);

                repository.RemoveSubscriptionsByIds(ids);
                CommitChanges(repository);
            }
        }
Пример #2
0
        public void Delete(string[] ids)
        {
            using (var repository = _subscriptionRepositoryFactory())
            {
                var subscriptions = GetByIds(ids);
                if (!subscriptions.IsNullOrEmpty())
                {
                    var changedEntries = subscriptions.Select(x => new GenericChangedEntry <Subscription>(x, EntryState.Deleted));
                    _eventPublisher.Publish(new SubscriptionChangingEvent(changedEntries));

                    //Remove subscription order prototypes
                    var orderPrototypesIds = repository.Subscriptions.Where(x => ids.Contains(x.Id)).Select(x => x.CustomerOrderPrototypeId).ToArray();
                    _customerOrderService.Delete(orderPrototypesIds);

                    repository.RemoveSubscriptionsByIds(ids);
                    CommitChanges(repository);

                    _eventPublisher.Publish(new SubscriptionChangedEvent(changedEntries));
                }
            }
        }
Пример #3
0
        public IHttpActionResult Deletecustomer_order(int customer_orderId)
        {
            ResponseDataDTO <customer_order> response = new ResponseDataDTO <customer_order>();

            try
            {
                var customer_orderDeleted = _customer_orderservice.Find(customer_orderId);
                if (customer_orderDeleted != null)
                {
                    _customer_orderservice.Delete(customer_orderDeleted);

                    // return response
                    response.Code    = HttpCode.OK;
                    response.Message = MessageResponse.SUCCESS;
                    response.Data    = null;
                    return(Ok(response));
                }
                else
                {
                    // return response
                    response.Code    = HttpCode.NOT_FOUND;
                    response.Message = MessageResponse.FAIL;
                    response.Data    = null;

                    return(Ok(response));
                }
            }
            catch (Exception ex)
            {
                response.Code    = HttpCode.INTERNAL_SERVER_ERROR;
                response.Message = ex.Message;
                response.Data    = null;
                Console.WriteLine(ex.ToString());

                return(Ok(response));
            }
        }
 public IHttpActionResult DeleteOrdersByIds([FromUri] string[] ids)
 {
     _customerOrderService.Delete(ids);
     return(StatusCode(HttpStatusCode.NoContent));
 }