public ActionResult UpdateCalendarEventOnDrop(string id, string title, string description, string location, string start, string end, string allDay) { // Convert start and end to DateTime objects DateTime startTime = DateTime.ParseExact(start, "dd-MM-yyyy HH:mm:ss", System.Globalization.CultureInfo.InvariantCulture); DateTime endTime = DateTime.ParseExact(end, "dd-MM-yyyy HH:mm:ss", System.Globalization.CultureInfo.InvariantCulture); int eventID = Convert.ToInt32(id); using (CalendarContext db = new CalendarContext()) { // Update CalendarEvent in database CalendarEvent calEventToUpdate = db.CalendarEvents.Where(ce => ce.EventID == eventID).FirstOrDefault(); // Create CalendarEvent to be passed to database // Only title, description, and location can be updated currently CalendarEvent calEvent = new CalendarEvent { EventID = Convert.ToInt32(id), FBID = (String)Session["FBID"], Title = title, Description = description, Location = location, StartTime = startTime, EndTime = endTime, Recurring = false, AllDay = calEventToUpdate.AllDay }; if (calEventToUpdate != null) { db.Entry(calEventToUpdate).CurrentValues.SetValues(calEvent); } db.SaveChanges(); } return View(); }