Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        public ActionResult Edit(int id)
        {
            LoadFormData();

            var meeting = MeetingsRepository.GetMeeting(id);
            var formModel = new MeetingFormModel(meeting);

            return View("Create", formModel);
        }
Ejemplo n.º 3
0
        public Meeting Create(MeetingFormModel formModel)
        {
            var meeting = new Meeting();

            SetID(meeting);

            _meetingFormModelBinder.FormModelToMeeting(formModel, meeting);

            DataContext.Current.Meetings.Add(meeting);

            return meeting;
        }
Ejemplo n.º 4
0
        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);
        }
Ejemplo n.º 5
0
        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);
        }
Ejemplo n.º 6
0
        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;
        }
Ejemplo n.º 7
0
        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;
        }
Ejemplo n.º 8
0
        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;
        }
Ejemplo n.º 9
0
 public ActionResult Create()
 {
     LoadFormData();
     var formModel = new MeetingFormModel();
     return View(formModel);
 }