public ActionResult Create(EditableMeetingViewModel model) { if (!ModelState.IsValid) { model.Locations = _locationRepository .GetLocations() .Select(location => new SelectListItem { Value = location.Id.ToString(), Text = location.Name }) .ToList(); return(View(model)); } var meeting = Mapper.Map <MeetingViewModel, Meeting>(model.Event); if (meeting != null && _meetingRepository.CreateMeeting(meeting)) { return(RedirectToAction("Index")); } return(View()); }
public ActionResult Create() { var model = new EditableMeetingViewModel(); model.Locations = _locationRepository .GetLocations() .Select(location => new SelectListItem { Value = location.Id.ToString(), Text = location.Name }) .ToList(); return(View(model)); }