// GET: SpecialitiesController/Details/5 public async Task <IActionResult> Details(int?id) { if (id == null) { return(NotFound()); } var speciality = await _specialityRepository.GetSpecialityWithRoomsAsync(id.Value); if (speciality == null) { return(NotFound()); } var model = _converterHelper.ToDetailsViewModel(speciality); return(View(model)); }
public async Task <IEnumerable <SelectListItem> > GetComboRoomsAsync(int specialityId) { var speciality = await _specialityRepository.GetSpecialityWithRoomsAsync(specialityId); var list = new List <SelectListItem>(); if (speciality != null) { list = speciality.Rooms.Select(r => new SelectListItem { Text = r.Name, Value = r.Id.ToString() }).OrderBy(l => l.Text).ToList(); } list.Insert(0, new SelectListItem { Text = "(Select a Room...)", Value = "0" }); return(list); }