Esempio n. 1
0
        public async Task <IActionResult> Create()
        {
            var months = await monthsService.GetAll();

            IEnumerable <SelectListItem> mappedMonths = months
                                                        .Select(c => new SelectListItem
            {
                Value = c.Id.ToString(),
                Text  = c.Name
            });

            ViewBag.MonthsId = mappedMonths;
            return(View());
        }
Esempio n. 2
0
        public async Task <IEnumerable <MonthsViewModels> > GetAll()
        {
            IEnumerable <MonthsViewModels> b;

            try
            {
                b = mapper.Map <IEnumerable <MonthsViewModels> >(await monthsService.GetAll());
            }
            catch { b = null; }
            return(b);
        }