Ejemplo n.º 1
0
        public IEnumerable <SelectListItem> SizeList(int productID, int colorID, int iconID)
        {
            IQueryable <SizeModel> size     = _sizeRepository.DisplayProductSize(productID, colorID, iconID);
            List <SelectListItem>  sizeList = new List <SelectListItem>();

            foreach (var item in size.Distinct())
            {
                int    sizeCount        = size.Where(s => s.SideID == item.SideID).Count();
                string sizeAvailability = sizeCount > 1 ? " --- " + sizeCount + " sizes are available" : "";

                sizeList.Add(new SelectListItem
                {
                    Value = item.SideID.ToString(),
                    Text  = item.Size + sizeAvailability
                });
            }
            return(sizeList);
        }