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



            _settingsBlProvider.DeleteCustomer(entityModel);


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

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

            return(RedirectToAction("CustomerManagement", "Settings"));
        }
Example #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);
        }
Example #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);
        }