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()); }
public async Task <IEnumerable <MonthsViewModels> > GetAll() { IEnumerable <MonthsViewModels> b; try { b = mapper.Map <IEnumerable <MonthsViewModels> >(await monthsService.GetAll()); } catch { b = null; } return(b); }