Exemplo n.º 1
0
        private GarmentsListData GetGarmentsListDataForNewUser()
        {
            GarmentsListData gld = new GarmentsListData();

            gld.Controller     = "GarmentSelector";
            gld.Action         = "GoToRegistration";
            gld.FashionFlavors = fashionFlavorRepository.GetByIds((from f in ClosetState.Flavors select f.Id).ToList <int>()).ToList <FashionFlavor>();
            gld.EventTypes     = eventTypeRepository.GetByIds((from e in ClosetState.EventTypes select e.Id).ToList <int>());

            if (gld.FashionFlavors != null)
            {
                gld.Silouhettes = silouhetteRepository.GetByFlavors(gld.FashionFlavors, gld.EventTypes) as List <Silouhette>;
                if (gld.Silouhettes != null)
                {
                    gld.Fabrics      = fabricRepository.GetForSilouhette(gld.Silouhettes[0], gld.EventTypes);
                    gld.FabricId     = gld.Fabrics.FirstOrDefault().Id;
                    gld.SilouhetteId = gld.Silouhettes[0].Id;
                    Pattern solid = patternRepository.GetSolid();
                    gld.Garments  = garmentRepository.GetBySelection(gld.Silouhettes[0], gld.Fabrics.FirstOrDefault(), solid, gld.EventTypes, new List <ClosetGarment>(), gld.MyWishGarments);
                    gld.PatternId = solid.Id;
                    gld.Patterns  = gld.Silouhettes[0].AvailablePatterns;
                    if (ClosetState.AddGarments != null)
                    {
                        if (ClosetState.AddGarments.Count > 0)
                        {
                            foreach (int garment in ClosetState.AddGarments)
                            {
                                gld.NewGarmentsIds += garment + ",";
                            }
                            gld.NewGarmentsIds.TrimEnd(',');
                            gld.NewGarments = garmentRepository.GetByIds(ClosetState.AddGarments);
                        }
                    }
                    if (ClosetState.WishGarments != null)
                    {
                        if (ClosetState.WishGarments.Count > 0)
                        {
                            foreach (int garment in ClosetState.WishGarments)
                            {
                                gld.NewWishGarmentsIds += garment + ",";
                            }
                            gld.NewWishGarmentsIds.TrimEnd(',');
                            gld.NewWishGarments = garmentRepository.GetByIds(ClosetState.WishGarments);
                        }
                    }
                }
            }
            return(gld);
        }