public ServiceResult UpdateRSVP(RSVPViewModel rsvpVM) { ServiceResult result; bool esito = false; string message = "Errore imprevisto"; try { string lastGUID = rsvpVM.GUID; int lastId = rsvpVM.IdRsvp; DateTime now = DateTime.Now; RSVPServices services = new RSVPServices(); RSVP rsvp = rsvpVM.ToRSVPEntity(now); message = string.Empty; services.UpdateRSVP(rsvp, lastId, lastGUID); SendMails(rsvp); esito = true; message = "Operazione completata"; result = new ServiceResult(esito, message, rsvp.Guid); } catch (Exception exc) { message = exc.Message; esito = false; result = new ServiceResult(esito, message, exc); exc.WriteToLog(); } return(result); }
public RSVPViewModel GetRSVPByGUID(string guid) { RSVPViewModel rsvpViewMode; try { RSVPServices services = new RSVPServices(); RSVP rsvp = services.GetCurrentRSVPByGUID(guid); if (rsvp == null) { throw new Exception(string.Format("RSVP {0} non trovato.", guid)); } rsvpViewMode = RSVPViewModel.ToRSVPViewModel(rsvp); } catch (Exception exc) { exc.WriteToLog(); throw new Exception("Purtroppo il tuo RSVP non è stato trovato!"); } return(rsvpViewMode); }