public ActionResult EditEventForm(EditEventModel e)
 {
     List<EventLocation> locations = this._db.Query<EventLocation>("SELECT * FROM ec_locations").ToList();
     locations.Insert(0, new EventLocation() { LocationName = "No Location", Id = 0 });
     SelectList list = new SelectList(locations, "Id", "LocationName", e.selectedLocation);
     e.locations = list;
     if (!ModelState.IsValid)
     {
         TempData["StatusEditEvent"] = "Invalid";
         return PartialView("EditEventForm",e);
     }
     TempData["StatusEditEvent"] = "Valid";
     CalendarEntry entry = new CalendarEntry()
     {
         allDay = e.allday,
         calendarId = e.calendarId,
         description = e.description,
         title = e.title,
         end = e.end,
         start = e.start,
         Id = e.Id,
         locationId = e.selectedLocation
     };
     this._db.Update(entry);
     return PartialView("EditEventForm",e);
 }
        public ActionResult EditEventForm(int id = 0)
        {
            List<EventLocation> locations = this._db.Query<EventLocation>("SELECT * FROM ec_locations").ToList();
            locations.Insert(0, new EventLocation() { LocationName = "No Location", Id = 0 });

            //Get the Event from Database
            CalendarEntry entry = this._db.SingleOrDefault<CalendarEntry>(id);
            //Create SelectList with selected location
            SelectList list = new SelectList(locations, "Id", "LocationName", entry.locationId);
            //Create Model for the View
            EditEventModel eem = new EditEventModel()
            {
                Id = entry.Id,
                title = entry.title,
                start = (DateTime)entry.start,
                description = entry.description,
                calendarId = entry.calendarId,
                allday = entry.allDay,
                locations = list
            };
            if (null != entry.end)
            {
                eem.end = (DateTime)entry.end;
            }

            return PartialView("EditEventForm",eem);
        }