public void Save(int meetingId, MeetingFormModel formModel) { var meeting = DataContext.Current.Meetings.FirstOrDefault(x => x.Id == meetingId); _meetingFormModelBinder.FormModelToMeeting(formModel, meeting); DataContext.Current.Meetings.Update(meeting); }
public ActionResult Edit(int id) { LoadFormData(); var meeting = MeetingsRepository.GetMeeting(id); var formModel = new MeetingFormModel(meeting); return View("Create", formModel); }
public Meeting Create(MeetingFormModel formModel) { var meeting = new Meeting(); SetID(meeting); _meetingFormModelBinder.FormModelToMeeting(formModel, meeting); DataContext.Current.Meetings.Add(meeting); return meeting; }
public ActionResult Edit(int id, MeetingFormModel formModel) { LoadFormData(); if (ModelState.IsValid) { MeetingsService.Save(id, formModel); Notice("Se dit flotte møde :)"); return RedirectToAction("Show", new { id }); } return View("Create", formModel); }
public ActionResult Create(MeetingFormModel formModel) { LoadFormData(); if (ModelState.IsValid) { var meeting = MeetingsService.Create(formModel); Notice("Se dit flotte møde :)"); return RedirectToAction("Show", new { id = meeting.Id }); } return View(formModel); }
public void FormModelToMeeting(MeetingFormModel formModel, Meeting meeting) { meeting.Url = formModel.Url; meeting.Title = formModel.Title; meeting.StartsAt = DateTime.Parse(formModel.StartsAtDate); if (formModel.City.IsPresent()) { meeting.City = new City() { Name = formModel.City }; } AddOrganizersToMeeting(meeting, formModel.Organizers); AddTagsToMeeting(meeting, formModel.Tags); meeting.Description = formModel.Description; }
public void FormModelToMeeting(MeetingFormModel formModel, Meeting meeting) { meeting.Url = formModel.Url; meeting.Title = formModel.Title; meeting.Address = formModel.Address; meeting.AddressFormatted = formModel.AddressFormatted; if (formModel.AddressLat.IsPresent() && formModel.AddressLng.IsPresent()) { meeting.Latitude = double.Parse(formModel.AddressLat, CultureInfo.InvariantCulture); meeting.Longtitude = double.Parse(formModel.AddressLng, CultureInfo.InvariantCulture); } meeting.StartsAt = DateTime.Parse(formModel.StartsAtDate + " " + formModel.StartsAtTime); if (formModel.City.IsPresent()) { meeting.City = new City() { Name = formModel.City }; } AddOrganizersToMeeting(meeting, formModel.Organizers); AddTagsToMeeting(meeting, formModel.Tags); meeting.Description = formModel.Description; }
public ActionResult Create() { LoadFormData(); var formModel = new MeetingFormModel(); return View(formModel); }