예제 #1
0
        public IActionResult DeleteCustomer(CustomerVm model)
        {
            var entityModel = CustomerVm.MapToEntityModel(model);



            _settingsBlProvider.DeleteCustomer(entityModel);


            return(RedirectToAction("CustomerManagement", "Settings"));
        }
예제 #2
0
        public IActionResult NewOrEditCustomer(CustomerVm model)
        {
            if (ModelState.IsValid)
            {
                var entityModel = CustomerVm.MapToEntityModel(model);

                _settingsBlProvider.AddOrUpdateCustomer(entityModel, model.UserIds);
            }

            return(RedirectToAction("CustomerManagement", "Settings"));
        }
예제 #3
0
        public static Entities.Entities.Invoice MapToEntityModel(InvoiceVm source)
        {
            var config = new MapperConfiguration(cfg => cfg.CreateMap <InvoiceVm, Entities.Entities.Invoice>()
                                                 .ForMember(x => x.Customer, y => y.MapFrom(z => CustomerVm.MapToEntityModel(z.Customer)))

                                                 );
            var mapper      = config.CreateMapper();
            var destination = mapper.Map <Entities.Entities.Invoice>(source);

            return(destination);
        }
예제 #4
0
        public static Entities.Entities.Order MapToEntityModel(OrderVm source)
        {
            var config = new MapperConfiguration(cfg => cfg.CreateMap <OrderVm, Entities.Entities.Order>()
                                                 .ForMember(x => x.OrderItems, y => y.MapFrom(z => z.OrderDetails.Select(OrderDetailVm.MapToEntityModel)))
                                                 .ForMember(x => x.Customer, y => y.MapFrom(z => CustomerVm.MapToEntityModel(z.Customer)))
                                                 );
            var mapper      = config.CreateMapper();
            var destination = mapper.Map <Entities.Entities.Order>(source);

            return(destination);
        }