Esempio n. 1
0
        public virtual void DeleteAddress(IRepositoryLocator locator, long addressId)
        {
            DeleteAddressValidate(locator, addressId);
            var address = AddressSet.Single(a => a.Id.Equals(addressId));

            AddressSet.Remove(address);
            locator.Remove(address);
        }
        private DtoResponse DeleteAddressCommand(IRepositoryLocator locator, long id)
        {
            var address = locator.GetById <Address>(id);

            BusinessNotifier.AddWarning(BusinessWarningEnum.Default,
                                        string.Format("Address with id:{0} was deleted",
                                                      address.Id));

            locator.Remove(address);
            return(new DtoResponse());
        }
Esempio n. 3
0
        private DtoResponse DeleteCommand(IRepositoryLocator locator, long id)
        {
            var TEntity = locator.GetById <TEntity>(id);

            //BusinessNotifier.AddWarning (BusinessWarningEnum.Default,
            //                            string.Format ("TEntity with id:{0} was deleted",
            //                            TEntity.Id));
            //string description = "Deleted " + typeof(TEntity).Name + " : " + GetEntityInstanceName(TEntity);
            //LoggActivity(description, loggedInUserDto);
            locator.Remove(TEntity);
            return(new DtoResponse());
        }
        private DtoResponse DeleteCustomerCommand(IRepositoryLocator locator, long id)
        {
            var customer = locator.GetById <Customer>(id);

            BusinessNotifier.AddWarning(BusinessWarningEnum.Default,
                                        string.Format("Customer {0} {1} [id:{2}] was deleted",
                                                      customer.FirstName,
                                                      customer.LastName,
                                                      customer.Id));

            locator.Remove(customer);
            return(new DtoResponse());
        }
Esempio n. 5
0
        private DtoResponse DeleteTestCustomer(IRepositoryLocator locator)
        {
            var customers = locator.FindAll <Customer>().Where(c => c.FirstName == "TestName").ToList();

            foreach (var customer in customers)
            {
                foreach (var address in customer.Addresses())
                {
                    customer.DeleteAddress(locator, address.Id);
                }
                locator.Remove(customer);
            }
            return(new DtoResponse());
        }