Exemplo n.º 1
0
        public List <SelectListItem> GetArticleSelector()
        {
            var  list        = new List <SelectListItem>();
            bool oneSelected = false;

            foreach (var article in Articles)
            {
                var tempSelected = Higlighted.Any(a => a.Id == article.Id) && !oneSelected;
                list.Add(new SelectListItem
                {
                    Text     = article.Name,
                    Value    = article.Id.ToString(),
                    Selected = tempSelected
                });
                if (tempSelected)
                {
                    if (First == Guid.Empty)
                    {
                        First = article.Id;
                    }
                    else if (Second == Guid.Empty)
                    {
                        Second = article.Id;
                    }
                    else if (Thirt == Guid.Empty)
                    {
                        Thirt = article.Id;
                    }
                    oneSelected = true;
                    Higlighted.Remove(Higlighted.FirstOrDefault(a => a.Id == article.Id));
                }
            }
            return(list);
        }
Exemplo n.º 2
0
        public List <SelectListItem> GetRentalSelecter()
        {
            var  list        = new List <SelectListItem>();
            bool oneSelected = false;

            foreach (var rental in Rentals)
            {
                var tempSelected = Higlighted.Any(r => r.Id == rental.Id) && !oneSelected;
                list.Add(new SelectListItem
                {
                    Text     = rental.Name,
                    Value    = rental.Id.ToString(),
                    Selected = tempSelected
                });
                if (tempSelected)
                {
                    if (First == Guid.Empty)
                    {
                        First = rental.Id;
                    }
                    else if (Second == Guid.Empty)
                    {
                        Second = rental.Id;
                    }
                    else if (Thirt == Guid.Empty)
                    {
                        Thirt = rental.Id;
                    }
                    else if (Fourth == Guid.Empty)
                    {
                        Fourth = rental.Id;
                    }
                    oneSelected = true;
                    Higlighted.Remove(Higlighted.FirstOrDefault(r => r.Id == rental.Id));
                }
            }
            return(list);
        }