public IActionResult Edit(int?id) { var model = id != null ? new EditPersonnelViewModel(_service.GetPersonnelItem(id.Value)) : new EditPersonnelViewModel(); model.Roles = _service.GetRoleItems().Select(a => new SelectListItem(a.RoleName, a.Id.ToString())); model.Titles = _service.GetTitleItems().Select(a => new SelectListItem(a.TitleName, a.Id.ToString())); return(View(model)); }