Exemplo n.º 1
0
        public OrdersPlacedVariantDTO GetOrderDeatils(Guid OrderPlacedID)
        {
            IEnumerable <OrderPlacedVariant> orderPlaced = dbContext.OrderPlacedVariants.Where(o => o.OrderPlacedID == OrderPlacedID).ToList();

            Debug.WriteLine(dbContext.OrderPlacedVariants.Where(o => o.OrderPlacedID == OrderPlacedID).ToList());

            OrdersPlacedVariantDTO ordersPlacedVaraiantDTO = new OrdersPlacedVariantDTO();

            ordersPlacedVaraiantDTO.VariantList = MyOrderDeatilsMapper.Map <IEnumerable <OrderPlacedVariant>, IEnumerable <OrderPlacedVariantDTO> >(orderPlaced);
            return(ordersPlacedVaraiantDTO);
        }
Exemplo n.º 2
0
        public ActionResult GetOrderDeatils(Guid OrderPlacedID)
        {
            OrderBusiness orderBusiness           = new OrderBusiness();
            Guid          UserID                  = new Guid(Session["userId"].ToString());
            var           MyOrderDeatilsDTOConfig = new MapperConfiguration(cfg =>
            {
                cfg.CreateMap <OrderPlacedVariantDTO, OrderPlacedVariantViewModel>();
            });

            try
            {
                OrdersPlacedVariantDTO orderPlacedVariantDTO = orderBusiness.GetOrderDeatils(OrderPlacedID);

                IMapper OrderVariant = new Mapper(MyOrderDeatilsDTOConfig);
                OrderPlacedVariantsViewModel orderPlacedVariantsViewModel = new OrderPlacedVariantsViewModel();
                orderPlacedVariantsViewModel.VariantList = OrderVariant.Map <IEnumerable <OrderPlacedVariantDTO>, IEnumerable <OrderPlacedVariantViewModel> >(orderPlacedVariantDTO.VariantList);
                return(View(orderPlacedVariantsViewModel));
            }
            catch (Exception)
            {
                return(RedirectToAction("ErrorViewShow", "HttpErrors", new { msg = "order deatils is missing" }));
            }
        }