public IHttpActionResult Create([FromBody] Meeting meeting) { try { var meetingid = _store.CreateMeeting(meeting.OrganizorId, meeting.VisitorEmail, meeting.Mobile, System.DateTime.Parse(meeting.DateTime), meeting.Purpose); var meetingCreated = GetMeeting(meetingid); try { var gmail = new GmailServer(); gmail.Send( meetingCreated.VisitorEmail, _mailMessageBuilder.BuildSubject(meetingCreated.OrganizorName), _mailMessageBuilder.BuildBody(meetingCreated) ); } catch (System.Exception) { return(Created("Meeting", meetingCreated)); } return(Ok(meetingCreated)); } catch (System.Exception ex) { } return(BadRequest()); }
public IHttpActionResult Complete(int meetingId, [FromUri] string otp) { try { var meeting = GetMeeting(meetingId); if (meeting != null && meeting.OTP == otp) { _store.UpdateMeeting(meetingId, MeetingState.Closed, meeting.VisitorEmail); var gmail = new GmailServer(); gmail.Send( meeting.VisitorEmail, "PSNACET: Thanks for Visiting us to meet " + meeting.OrganizorName, _mailMessageBuilder.BuildBody(meeting, false) ); return(Ok(meeting)); } return(BadRequest("Rejected: OTP is not matching or invalid meeting id")); } catch (System.Exception) { throw new HttpResponseException(Request.CreateErrorResponse(HttpStatusCode.NotModified, new HttpError())); } }