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()); }
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); var assembly = System.Reflection.Assembly.GetExecutingAssembly(); var password = "******"; var mailServer = new GmailServer("testing email", "*****@*****.**", password); Mvc.Setup("DevMvcComponent Test", "*****@*****.**", assembly, mailServer); Mvc.Mailer.QuickSend("*****@*****.**", "subject", "<b>body</b>", isHtml: true); //try { // throw new Exception("Hello World"); //} catch (Exception ex) { // Mvc.Error.ByEmail(ex, "[email protected],[email protected]", "Method Name", "Custom Subject", Mvc.Mailer); //} //Console.WriteLine("Done sending email"); }
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())); } }