public async Task <ActionResult> Edit(string id, int page, FormCollection collection) { IEvent updatedEvent = await _calenderOperations.UpdateCalendarEventAsync(id, collection["Location"], collection["Body"], collection["Attendees"], collection["Subject"], DateTimeOffset.Parse(collection["StartDate"]), DateTimeOffset.Parse(collection["EndDate"])); return(RedirectToAction("Index", new { page, changedid = id })); }
/// <summary> /// Saves changes to a calendar event on the Exchange service and /// updates the local collection of calendar events. /// </summary> public async void ExecuteSaveChangesCommandAsync() { string operationType = string.Empty; try { if (!String.IsNullOrEmpty(this.Id)) { LoggingViewModel.Instance.Information = "Updating event ..."; operationType = "update"; //Send changes to Exchange _serverEventData = await _calenderOperations.UpdateCalendarEventAsync( this.Id, this.LocationName, this.BodyContent, this.Attendees, this.Subject, this.Start, this.End, this.StartTime, this.EndTime); this.IsNewOrDirty = false; LoggingViewModel.Instance.Information = "The event was updated in your calendar"; } else { LoggingViewModel.Instance.Information = "Adding event ..."; operationType = "save"; //Add the event //Send the add request to Exchange service with new event properties this.Id = await _calenderOperations.AddCalendarEventAsync( this.LocationName, this.BodyContent, this.Attendees, this.Subject, this.Start, this.End, this.StartTime, this.EndTime); this.IsNewOrDirty = false; LoggingViewModel.Instance.Information = "The event was added to your calendar"; } } catch (Exception) { LoggingViewModel.Instance.Information = string.Format("We could not {0} your calendar event in your calendar", operationType); } }
public async Task <ActionResult> Edit(string id, int page, FormCollection collection) { _O365ServiceOperationFailed = false; try { await _calenderOperations.UpdateCalendarEventAsync(id, collection["Location"], collection["Body"], collection["Attendees"], collection["Subject"], DateTimeOffset.Parse(collection["StartDate"]), DateTimeOffset.Parse(collection["EndDate"])); } catch (Exception) { _O365ServiceOperationFailed = true; } return(RedirectToAction("Index", new { page, changedid = id })); }
//[Authorize] public async Task <ActionResult> Edit(NieuweAfspraakPM a) { if (ModelState.IsValid) { string verplaatsing = Request.Form["Verplaatsing"]; if (verplaatsing != null && verplaatsing.Equals("on")) { a.Afspraak.Verplaatsing = true; } else { a.Afspraak.Verplaatsing = false; } if (a.Afspraak.Klant.ID != 0) { a.Afspraak.Klant = ks.GetKlantByID(a.Afspraak.Klant.ID); } a.Afspraak.Masseur = afs.GetMasseurByID(a.Afspraak.Masseur.ID); if (a.Afspraak.SoortAfspraak.ID != 0) { a.Afspraak.SoortAfspraak = afs.GetMassageByID(a.Afspraak.SoortAfspraak.ID); } if (a.Afspraak.Arrangement.ID != 0) { a.Afspraak.Arrangement = afs.GetArrangementByID(a.Afspraak.Arrangement.ID); } if (a.Afspraak.Extra.ID != 0) { a.Afspraak.Extra = afs.GetExtraByID(a.Afspraak.Extra.ID); } if (a.Afspraak.Arrangement != null && a.Afspraak.SoortAfspraak != null) { a.Afspraak.Duur = a.Afspraak.SoortAfspraak.Duur + a.Afspraak.Arrangement.Duur; } else if (a.Afspraak.SoortAfspraak != null) { a.Afspraak.Duur = a.Afspraak.SoortAfspraak.Duur; } else if (a.Afspraak.Arrangement != null) { a.Afspraak.Duur = a.Afspraak.Arrangement.Duur; } else { a.Afspraak.Duur = 60; } if (a.Datum.Date == DateTime.MinValue) { a.Afspraak.DatumTijdstip = ViewBag.Datum + a.Tijdstip.TimeOfDay; } else { a.Afspraak.DatumTijdstip = a.Datum.Date + a.Tijdstip.TimeOfDay; } _O365ServiceOperationFailed = false; String newEventID = ""; List <CalendarEvent> list = new List <CalendarEvent>(); try { Afspraak afspraak = afs.GetAfspraakByID(a.Afspraak.ID); //newEventID = await _calenderOperations.AddCalendarEventAsync(a.Afspraak.Klant.Adres.ToString(), a.Afspraak.Klant.ToString(), a.Afspraak.Klant.Naam + " " + a.Afspraak.Klant.Voornaam, a.Afspraak.SoortAfspraak.Naam + " - " + a.Afspraak.Masseur.Naam, DateTimeOffset.Parse(a.Afspraak.DatumTijdstip.ToString()), DateTimeOffset.Parse(a.Afspraak.DatumTijdstip.ToString())); list = await _calenderOperations.GetCalanderByDate(afspraak.DatumTijdstip, afspraak.DatumTijdstip.AddMinutes(afspraak.Duur)); if (list.Count == 1) { await _calenderOperations.UpdateCalendarEventAsync(list.First().ID, a.Afspraak.Klant.Adres.ToString(), a.Afspraak.Klant.ToString(), "", a.Afspraak.SoortAfspraak.Naam + " - " + a.Afspraak.Masseur.Naam, DateTimeOffset.Parse(a.Afspraak.DatumTijdstip.ToString()), DateTimeOffset.Parse(a.Afspraak.DatumTijdstip.ToString())); } } catch (Exception) { _O365ServiceOperationFailed = true; } afs.UpdateAfspraak(a.Afspraak); if (a.Afspraak.Geannuleerd == false) { return(RedirectToAction("Index")); } else { a.Afspraak.Geannuleerd = false; TempData["error"] = "Er is reeds een afspraak op dit tijdstip gemaakt!"; return(RedirectToAction("Index")); // } } //return View(a); TempData["error"] = "Foutieve aanpassingen!"; return(RedirectToAction("Index")); }