Пример #1
0
        ICollection <SelectListItem> GetRoles()
        {
            List <SelectListItem> selectListItems = new List <SelectListItem>();

            if (_repository != null)
            {
                var allRoles = _repository.GetRoles().ToList();


                if (allRoles != null)
                {
                    foreach (var role in allRoles)
                    {
                        selectListItems.Add(new SelectListItem {
                            Text = role.Name, Value = role.Id.ToString()
                        });
                    }
                }
            }

            return(selectListItems);
        }
 // GET: Capacity
 public ActionResult Index()
 {
     return(View(_repository.GetRoles()));
 }