public ActionResult Delete(int? id) { if (id == null) { return new HttpStatusCodeResult(HttpStatusCode.BadRequest); } var profile = _uow.ProfileRepository.GetById(id); if (profile == null) { return HttpNotFound(); } var profileView = new ProfileView { Id = profile.Id, Title = profile.Title, Description = profile.Description, }; return View(profileView); }
// GET: Profile/Details/5 public ActionResult Details(int id) { var profile = _uow.ProfileRepository.GetAll().First(p => p.Id == id); var intervalsList = new List<IntervalView>(); var intervals = profile.Intervals.OrderBy(i => i.Start); foreach (var interval in intervals) { intervalsList.Add( new IntervalView { Description = interval.Description, Start = interval.Start, End = interval.End }); } var profileView = new ProfileView { Id = profile.Id, Title = profile.Title, Description = profile.Description, IsDefault = profile.UserDataId == null, Intervals = intervalsList, Type = profile.UserDataId == null ? "Default" : "Custom" }; return View(profileView); }