public IActionResult Index() { List <AbsenceType> absenceTypes = absenceTypeService.GetAll(); List <AbsenceTypeViewModel> model = new List <AbsenceTypeViewModel>(); if (absenceTypes?.Count > 0) { foreach (var item in absenceTypes) { model.Add(new AbsenceTypeViewModel { Id = item.Id, Name = item.Name, IsHourly = item.IsHourly }); } } return(View(model)); }
private void AddAbsenceTypesToViewBag() { ViewBag.AbsenceTypes = new SelectList(absenceTypeService.GetAll(), "Id", "Name"); }