Пример #1
0
 protected virtual ActionResult View(Photomodel model)
 {
     return(View("Details", new ViewData.Model.DetailsViewData()
     {
         Item = ObjectExtension.As <PhotomodelViewModel.Details>(model)
     }));
 }
        private ActionResult Details(RouteEntity entity, string category, string slug)
        {
            if (entity is Photoshop)
            {
                var data = new ProductViewData
                {
                    Menu = ObjectExtension.As <IList <MenuItemViewModel> >(_context.AbstractMenuItem.Where(x => x.RouteID == entity.ID))
                };
                this.SetTheme(entity);
                var link = entity as Photoshop;
                data.Route = ObjectExtension.As <PhotoshopViewModel.Summary>(entity);

                data.PhototechnicsViewModel = ObjectExtension.As <PhototechnicsViewModel.Details>(_context.PricePositions.Where(x => x.PhotoshopID == entity.ID && x.Phototechnics.Shortcut == slug)
                                                                                                  .Include(x => x.Phototechnics.ParameterValues).Include(x => x.Phototechnics.ParameterValues.Select(y => y.Parameter)).FirstOrDefault());
                return(View("Details", data));
            }
            if (entity is Photorent)
            {
                var data = new ProductViewData
                {
                    Menu = ObjectExtension.As <IList <MenuItemViewModel> >(_context.AbstractMenuItem.Where(x => x.RouteID == entity.ID))
                };
                this.SetTheme(entity);
                var link = entity as Photorent;
                data.Route = ObjectExtension.As <PhotorentViewModel.Details>(entity);

                data.Categorieses = ObjectExtension.As <IList <CategoryViewModel> >(_context.Categories.ToList());

                data.PhototechnicsViewModel = ObjectExtension.As <PhototechnicsViewModel.Details>(link.RentCalendars.SingleOrDefault(x => x.Phototechnics.Shortcut == slug));
                return(View("Details", data));
            }
            return(View("Details"));
        }
Пример #3
0
 protected virtual ActionResult View(Masterclass model)
 {
     return(View("Details",
                 new ViewData.Masterclass.DetailsViewData()
     {
         Item = ObjectExtension.As <MasterclassViewModel.Details>(model)
     }));
 }
Пример #4
0
        protected virtual ActionResult View(Page phs)
        {
            var ids = phs.Wall.Select(x => x.ID).ToList();

            Context.WallPostAddView(ids);
            Context.SaveChanges();
            return(View("Details", new ViewData.Page.DetailsViewData()
            {
                Item = ObjectExtension.As <PublicViewModel.Details>(phs)
            }));
        }
Пример #5
0
        protected virtual ActionResult View(Photographer model)
        {
            var ids = model.Wall.Select(x => x.ID).ToList();

            Context.WallPostAddView(ids);
            Context.SaveChanges();
            return(View("Details", new ViewData.Photographer.DetailsViewData()
            {
                Item = ObjectExtension.As <PhotographerViewModel.Details>(model)
            }));
        }
        private ActionResult Cart(RouteEntity entity)
        {
            if (entity is Photoshop)
            {
                this.SetTheme(entity);

                var viewdata = new CartViewData
                {
                    Menu         = ObjectExtension.As <IList <MenuItemViewModel> >(_context.AbstractMenuItem.Where(x => x.RouteID == entity.ID)),
                    Route        = ObjectExtension.As <PhotoshopViewModel.Summary>(entity),
                    Categorieses = ObjectExtension.As <IList <CategoryViewModel> >(_context.Categories.Include(x => x.Brands).ToList())
                };

                var cookie = Request.Cookies.Get("shoppingCart");

                string products = string.Empty;

                if (cookie != null)
                {
                    products = HttpUtility.UrlDecode(cookie.Value);
                }

                var serializer = new JavaScriptSerializer();

                if (products == null)
                {
                    viewdata.Orders = new List <OrderLineViewModel>();
                }
                else
                {
                    var data = serializer.Deserialize <IList <PhototechnicsOrderLine> >(products);

                    if (data == null)
                    {
                        viewdata.Orders = new List <OrderLineViewModel>();
                    }
                    else
                    {
                        var ids = data.Select(x => x.PricePositionID).ToList();

                        var query = (entity as Photoshop).Positions.Where(x => ids.Contains(x.ID));

                        viewdata.Orders = ObjectExtension.As <IList <OrderLineViewModel> >(query.ToList());
                    }
                }
                return(View("Cart", viewdata));
            }
            return(View("Cart"));
        }
        private ActionResult Index(RouteEntity entity)
        {
            if (entity is Photoshop)
            {
                this.SetTheme(entity);
                var data = new VitrineViewData
                {
                    Menu         = ObjectExtension.As <IList <MenuItemViewModel> >(_context.AbstractMenuItem.Where(x => x.RouteID == entity.ID)),
                    Route        = ObjectExtension.As <PhotoshopViewModel.Summary>(entity),
                    Categorieses = ObjectExtension.As <IList <CategoryViewModel> >(_context.Categories
                                                                                   .Include(x => x.Brands.Select(y => y.Brand))
                                                                                   .ToList())
                };

                data.Technics = _phototechnicsService.GetPhotoshopTechnics(data.Route, new PageRequest <PricePosition>
                {
                    Where = x => x.PhotoshopID == entity.ID
                });

                return(View("Index", data));
            }

            if (entity is Photorent)
            {
                var data = new VitrineViewData <PhotorentViewModel.Details>
                {
                    Menu = ObjectExtension.As <IList <MenuItemViewModel> >(_context.AbstractMenuItem.Where(x => x.RouteID == entity.ID))
                };

                this.SetTheme(entity);

                data.RouteDetails = ObjectExtension.As <PhotorentViewModel.Details>(entity);
                data.Categorieses = ObjectExtension.As <IList <CategoryViewModel> >
                                        (_context.Categories
                                        .Include(x => x.Brands.Select(y => y.Brand))
                                        .ToList());

                data.Technics = _phototechnicsService.GetPhotorentTechnics(data.RouteDetails, new PageRequest <RentCalendar>
                {
                    Page  = 0,
                    Size  = 20,
                    Where = x => x.PhotorentID == entity.ID
                });

                return(View("Index", data));
            }

            return(View("Index"));
        }
Пример #8
0
        protected virtual ActionResult View(Photoshop model)
        {
            var vmodel = ObjectExtension.As <PhotoshopViewModel.Details>(model);
            var data   = new ViewData.Photoshop.DetailsViewData
            {
                RouteDetails = vmodel,
                Technics     = _phototechnicsService.GetPhotoshopTechnics(vmodel, new PageRequest <PricePosition>()
                {
                    Where = x => x.PhotoshopID == vmodel.ID
                }),
                Categorieses = ObjectExtension.As <IList <CategoryViewModel> >(Context.Categories.Include(x => x.Brands).ToList())
            };

            return(View("Details", data));
        }
Пример #9
0
        protected virtual ActionResult View(Photorent model)
        {
            var vmodel = ObjectExtension.As <PhotorentViewModel.Details>(model);
            var data   = new ViewData.Photorent.DetailsViewData
            {
                RouteDetails = vmodel,
                Categorieses = ObjectExtension.As <IList <CategoryViewModel> >(Context.Categories.ToList()),
                Technics     = _phototechnicsService.GetPhotorentTechnics(vmodel, new PageRequest <RentCalendar>()
                {
                    Where = x => x.PhotorentID == vmodel.ID
                }),
            };

            return(View("Details", data));
        }
Пример #10
0
        public ActionResult Halls()
        {
            var query = _context.Halls
                        .Include(x => x.Photos)
                        .Include(y => y.Calendar)
                        .Include(z => z.Schedule)
                        .Include(i => i.Photostudio)
                        .ToList();


            var model = new HallsViewData
            {
                Page = new PageView <HallViewModel.Summary>
                {
                    Elements   = ObjectExtension.As <IList <HallViewModel.Summary> >(query),
                    ItemsCount = 20,
                    PageSize   = 20
                }
            };

            return(View(model));
        }