public ActionResult Create(FormCollection collection)
 {
     var vts = new VolunteerTimeSlot();
     //TODO: all these parses might fail. fix it
     TimeSlot timeslot =
         _repository.GetTimeSlotById(
             int.Parse(collection["VolunteerTimeSlot.timeslot_id"]));
     if (timeslot != null)
     {
         vts.TimeSlot = timeslot;
         vts.is_video = collection["VolunteerTimeSlot.is_video"].Contains("true");
         _repository.AddVolunteerTimeSlot(vts);
         _repository.Save();
         return RedirectToAction("Index");
     }
     return View("Create", MakeEditDataFromVolunteerTimeSlot(vts));
 }
예제 #2
0
 public void UnRegisterVolunteerForVolunteerTimeSlot(Volunteer v, VolunteerTimeSlot vts)
 {
     throw new NotImplementedException();
 }
예제 #3
0
 public void DeleteVolunteerTimeSlot(VolunteerTimeSlot vts)
 {
     throw new NotImplementedException();
 }
        public void UnRegisterVolunteerForVolunteerTimeSlot(Volunteer v,
															VolunteerTimeSlot vts)
        {
            // there appears to be a weird race condition here where if someone times it just right
            // or is editted just right, they can actually get registered for something twice
            // that would cause this to blow up if we look for SingleOrDefault
            IEnumerable<VolunteersVolunteerTimeSlot> vvtss =
                _conferenceware.VolunteersVolunteerTimeSlots.Where(
                    x => x.Volunteer == v && x.VolunteerTimeSlot == vts);
            _conferenceware.VolunteersVolunteerTimeSlots.DeleteAllOnSubmit(vvtss);
        }
        public void RegisterVolunteerForVolunteerTimeSlot(Volunteer v,
														  VolunteerTimeSlot vts)
        {
            if (_conferenceware.VolunteersVolunteerTimeSlots.SingleOrDefault(x =>
                                                                             x.Volunteer ==
                                                                             v &&
                                                                             x.
                                                                                VolunteerTimeSlot ==
                                                                             vts) == null)
            {
                var vvts = new VolunteersVolunteerTimeSlot
                            {
                                Volunteer = v,
                                VolunteerTimeSlot = vts,
                                comment = ""
                            };
                _conferenceware.VolunteersVolunteerTimeSlots.InsertOnSubmit(vvts);
            }
        }
 public void DeleteVolunteerTimeSlot(VolunteerTimeSlot vts)
 {
     _conferenceware.VolunteerTimeSlots.DeleteOnSubmit(vts);
 }
 public void AddVolunteerTimeSlot(VolunteerTimeSlot vts)
 {
     _conferenceware.VolunteerTimeSlots.InsertOnSubmit(vts);
 }
        private VolunteerTimeSlotEditData MakeEditDataFromVolunteerTimeSlot(
			VolunteerTimeSlot volunteerTimeSlot)
        {
            List<TimeSlot> timeslots = _repository.GetAllTimeSlots().ToList();
            foreach (VolunteerTimeSlot vts in _repository.GetAllVolunteerTimeSlots())
            {
                timeslots.Remove(vts.TimeSlot);
            }
            return new VolunteerTimeSlotEditData
                    {
                        VolunteerTimeSlot = volunteerTimeSlot,
                        Timeslots = new SelectList(timeslots, "id", "StringValue")
                    };
        }
 partial void DeleteVolunteerTimeSlot(VolunteerTimeSlot instance);
 partial void UpdateVolunteerTimeSlot(VolunteerTimeSlot instance);
 partial void InsertVolunteerTimeSlot(VolunteerTimeSlot instance);