Ejemplo n.º 1
0
        public ActionResult Index()
        {
            MembershipUser mu = Membership.GetUser();

            if (mu != null)
            {
                ViewData["UserName"] = mu.UserName;
            }

            RegisteredUser user = registeredUserRepository.GetByMembershipId(Convert.ToInt32(mu.ProviderUserKey));

            LoadSeasons();

            IList <Category> categories = categoryRepository.GetAll();

            foreach (Category category in categories)
            {
                ViewData["Category" + category.Description] = category.Id;
            }

            IList <FashionFlavor> flavors = new List <FashionFlavor>();

            foreach (UserFlavor flavor in user.UserFlavors)
            {
                flavors.Add(flavor.Flavor);
            }
            ViewData["FashionFlavors"] = flavors;

            List <WebClosetGarment> webClosetGarments = closetRepository.GetWebClosetGarments(user);

            ViewData["pants_jeans"] = webClosetGarments.FindAll(delegate(WebClosetGarment record)
            {
                if (record.CatId == (int)ViewData["CategoryPants"] || record.CatId == (int)ViewData["CategoryJeans"])
                {
                    return(true);
                }
                return(false);
            });

            ViewData["skirts_shorts"] = webClosetGarments.FindAll(delegate(WebClosetGarment record)
            {
                if (record.CatId == (int)ViewData["CategoryShorts"] || record.CatId == (int)ViewData["CategorySkirts"])
                {
                    return(true);
                }
                return(false);
            });

            ViewData["dresses"] = webClosetGarments.FindAll(delegate(WebClosetGarment record)
            {
                if (record.CatId == (int)ViewData["CategoryDresses"])
                {
                    return(true);
                }
                return(false);
            });

            ViewData["jackets"] = webClosetGarments.FindAll(delegate(WebClosetGarment record)
            {
                if (record.CatId == (int)ViewData["CategoryJackets"])
                {
                    return(true);
                }
                return(false);
            });

            ViewData["tops"] = webClosetGarments.FindAll(delegate(WebClosetGarment record)
            {
                if (record.CatId == (int)ViewData["CategoryCoats"] || record.CatId == (int)ViewData["CategoryCardigan"] || record.CatId == (int)ViewData["CategoryShirts"])
                {
                    return(true);
                }
                return(false);
            });

            ViewData["accesories"] = webClosetGarments.FindAll(delegate(WebClosetGarment record)
            {
                if (record.CatId == (int)ViewData["CategoryJewelry"] || record.CatId == (int)ViewData["CategoryBelts"] || record.CatId == (int)ViewData["CategoryShoes"] || record.CatId == (int)ViewData["CategoryBags"])
                {
                    return(true);
                }
                return(false);
            });

            return(View());
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Shows the default page for My Garments screen.
        /// </summary>
        /// <returns></returns>
        public ActionResult Index()
        {
            LoadSeasons();

            IList <Category> categories = categoryRepository.GetAll();

            foreach (Category category in categories)
            {
                ViewData["Category" + category.Description] = category.Id;
            }

            List <WebClosetGarment> webClosetGarments = closetRepository.GetWebClosetGarments(this.ProxyLoggedUser);

            ViewData["pants_jeans"] = webClosetGarments.FindAll(delegate(WebClosetGarment record)
            {
                if (record.CatId == (int)ViewData["CategoryPants"] || record.CatId == (int)ViewData["CategoryJeans"])
                {
                    return(true);
                }
                return(false);
            });

            ViewData["skirts_shorts"] = webClosetGarments.FindAll(delegate(WebClosetGarment record)
            {
                if (record.CatId == (int)ViewData["CategoryShorts"] || record.CatId == (int)ViewData["CategorySkirts"])
                {
                    return(true);
                }
                return(false);
            });

            ViewData["dresses"] = webClosetGarments.FindAll(delegate(WebClosetGarment record)
            {
                if (record.CatId == (int)ViewData["CategoryDresses"])
                {
                    return(true);
                }
                return(false);
            });

            ViewData["jackets"] = webClosetGarments.FindAll(delegate(WebClosetGarment record)
            {
                if (record.CatId == (int)ViewData["CategoryJackets"] || record.CatId == (int)ViewData["CategoryCoats"] || record.CatId == (int)ViewData["CategoryCardigan"])
                {
                    return(true);
                }
                return(false);
            });

            ViewData["tops"] = webClosetGarments.FindAll(delegate(WebClosetGarment record)
            {
                if (record.CatId == (int)ViewData["CategoryTops"])
                {
                    return(true);
                }
                return(false);
            });

            ViewData["accesories"] = webClosetGarments.FindAll(delegate(WebClosetGarment record)
            {
                if (record.CatId == (int)ViewData["CategoryJewelry"] || record.CatId == (int)ViewData["CategoryBelts"] || record.CatId == (int)ViewData["CategoryShoes"] || record.CatId == (int)ViewData["CategoryBags"])
                {
                    return(true);
                }
                return(false);
            });

            //ViewData["styleAlerts"] = contentService.GetRandomStyleAlerts((IList<FashionFlavor>)ViewData["fashionFlavors"], 1);

            return(View());
        }