Exemplo n.º 1
0
        public async Task <IEnumerable <SelectListItem> > GetComboSubMotivos()
        {
            List <SubMotivosIncidenciasViewModel> tipos = new List <SubMotivosIncidenciasViewModel>();

            tipos = await _datosRepository.GetSubMotivosIncidenciasAsync();

            List <SelectListItem> myList = new List <SelectListItem>();
            int id = 1;

            foreach (var Data in tipos)
            {
                var data =
                    new SelectListItem
                {
                    Value = Data.Submotivo,
                    Text  = Data.Submotivo
                };
                myList.Add(data);
                id = id + 1;
            }
            ;

            myList.Insert(0, new SelectListItem
            {
                Text  = "(Seleccionar un SubMotivo...)",
                Value = ""
            });

            return(myList);
            //throw new NotImplementedException();
        }