Esempio n. 1
0
        public async Task <IEnumerable <Color> > GetColors()
        {
            var entities = await _colorRepository.Get();

            var model = _mapper.Map <IEnumerable <Color> >(entities);

            return(model);
        }
Esempio n. 2
0
        public bool GetColorAny(Guid id)
        {
            var color = colorRepository.Get(x => x.Id == id);

            if (color.Clases.Count > 0)
            {
                return(true);
            }
            return(false);
        }
        public ResponseColor GetColor(int id)
        {
            ResponseColor responseColor = new ResponseColor();

            if (colorRepository.GetAll().FirstOrDefault() == null)
            {
                responseColor.Success = false;
                responseColor.Message = "ERROR: no colors found";
            }
            else if (!colorRepository.GetAll().Any(t => t.ColorId == id))
            {
                responseColor.Success = false;
                responseColor.Message = "ERROR: no color found with id=" + id;
            }
            else
            {
                responseColor.Color   = colorRepository.Get(id);
                responseColor.Success = true;
                responseColor.Message = "color found";
            }
            return(responseColor);
        }
Esempio n. 4
0
 public async Task <Color> Get(int id)
 {
     return(await _brandRepository.Get(id));
 }
Esempio n. 5
0
 public Color Get(int id)
 {
     return(colorRepo.Get(id));
 }
Esempio n. 6
0
        private ArrayList GetFormatedValues(FormCollection values)
        {
            ArrayList   lst       = new ArrayList();
            UserGarment ug        = new UserGarment();
            int         controlId = int.Parse(((NameValueCollection)(values)).AllKeys[0].Substring(
                                                  ((NameValueCollection)(values)).AllKeys[0].Length - 1, 1));

            foreach (string tag in values)
            {
                if (tag == "x" || tag == "y")
                {
                    continue;
                }

                if (int.Parse(tag.Substring(tag.Length - 1)) != controlId)
                {
                    lst.Add(ug);
                    ug = new UserGarment();
                    controlId++;
                }

                string propName  = tag.Substring(0, tag.Length - 1);
                string propValue = values[tag.ToString()];

                if (propValue == "")
                {
                    continue;
                }

                switch (propName)
                {
                case "Title":
                    Silouhette s = silouhetteRepository.Get(int.Parse(propValue));
                    ug.Title           = s.Category.Description + " " + s.Description;
                    ug.Tags.Silouhette = s;
                    break;

                case "Fabric":
                    ug.Tags.Fabric = fabricRepository.Get(int.Parse(propValue));
                    break;

                case "PrimaryColor":
                    ug.Tags.Colors.Add(colorRepository.Get(int.Parse(propValue)));
                    break;

                case "Pattern":
                    ug.Tags.Pattern = patternRepository.Get(int.Parse(propValue));
                    break;

                case "Season":
                    ug.Tags.Seasons.Add((Season)int.Parse(propValue));
                    break;

                case "EventType":
                    ug.Tags.EventTypes.Add(eventTypeRepository.Get(int.Parse(propValue)));
                    break;

                case "PrivacyStatus":
                    ug.Visibility = (Convert.ToBoolean(propValue)) ? GarmentVisibility.Private : GarmentVisibility.Public;
                    break;
                }
            }

            lst.Add(ug);
            return(lst);
        }
Esempio n. 7
0
 public Task <IEnumerable <Color> > GetColors() => _colorRepository.Get();
Esempio n. 8
0
        private ArrayList GetFormatedValues(FormCollection values)
        {
            ArrayList   lst = new ArrayList();
            UserGarment ug  = new UserGarment();

            if (values.Count == 0)
            {
                return(lst);
            }

            int controlId = int.Parse(((NameValueCollection)(values)).AllKeys[0].Substring(
                                          ((NameValueCollection)(values)).AllKeys[0].Length - 1, 1));

            string titleSilouhette = string.Empty;
            string titleCategory   = string.Empty;
            string titleColor      = string.Empty;
            string titlePattern    = string.Empty;
            string titleFabric     = string.Empty;

            foreach (string tag in values)
            {
                if (tag == "x" || tag == "y")
                {
                    continue;
                }

                if (int.Parse(tag.Substring(tag.Length - 1)) != controlId)
                {
                    ug.Title = string.Format("{0} {1} {2} {3} {4}", titleSilouhette, titleColor, titlePattern, titleCategory, titleFabric);
                    lst.Add(ug);
                    ug = new UserGarment();
                    titleSilouhette = string.Empty;
                    titleCategory   = string.Empty;
                    titleColor      = string.Empty;
                    titlePattern    = string.Empty;
                    titleFabric     = string.Empty;
                    controlId++;
                }

                string propName  = tag.Substring(0, tag.Length - 1);
                string propValue = values[tag.ToString()];

                if (propValue == "")
                {
                    continue;
                }

                switch (propName)
                {
                case "Title":
                    Silouhette s = silouhetteRepository.Get(int.Parse(propValue));
                    titleSilouhette    = s.Description;
                    titleCategory      = s.Category.Description;
                    ug.Tags.Silouhette = s;
                    break;

                case "Fabric":
                    Fabric f = fabricRepository.Get(int.Parse(propValue));
                    ug.Tags.Fabric = f;
                    titleFabric    = f.Description;
                    break;

                case "PrimaryColor":
                    FashionAde.Core.Clothing.Color col = colorRepository.Get(int.Parse(propValue));
                    ug.Tags.Colors.Add(col);
                    ug.Tags.DefaultColor = col;
                    titleColor           = col.Description;
                    break;

                case "Pattern":
                    Pattern p = patternRepository.Get(int.Parse(propValue));
                    ug.Tags.Pattern = p;
                    titlePattern    = p.Description;
                    break;

                case "Season":
                    ug.Tags.Seasons.Add((Season)int.Parse(propValue));
                    break;

                case "EventType":
                    ug.Tags.EventTypes.Add(eventTypeRepository.Get(int.Parse(propValue)));
                    break;

                case "PrivacyStatus":
                    ug.SetVisibility((Convert.ToBoolean(propValue)) ? GarmentVisibility.Private : GarmentVisibility.Public);
                    break;
                }
            }
            ug.Title = string.Format("{0} {1} {2} {3} {4}", titleSilouhette, titleColor, titlePattern, titleCategory, titleFabric);

            if (ug.Title != "    ")
            {
                lst.Add(ug);
            }
            return(lst);
        }