// // GET: /Olympiad/Delete/5 public ActionResult Delete(int?id) { OlympiadDTO olympiadDto = _olympiadService.GetItem(id); var universityForName = _universityService.GetItem(olympiadDto.UniversityID); ViewBag.University = universityForName.UniversityName; var olympiad = Mapper.Map <OlympiadDTO, OlympiadViewModel>(olympiadDto); return(View(olympiad)); }
// // GET: /Olympiad/Edit/5 public ActionResult Edit(int id) { OlympiadDTO olympiadDto = _olympiadService.GetItem(id); var allUniversities = _universityService.GetItems(); var items = new List <SelectListItem>(); foreach (var univ in allUniversities) { items.Add(new SelectListItem() { Text = univ.UniversityName, Value = univ.UniversityID.ToString() }); } ViewBag.Universities = items; var olympiad = Mapper.Map <OlympiadDTO, OlympiadViewModel>(olympiadDto); return(View(olympiad)); }