public HttpResponseMessage Post([FromBody] tbl_web_driver_application driver_application) { try { using (cascadiaEntities entities = new cascadiaEntities()) { entities.tbl_web_driver_application.Add(driver_application); entities.SaveChanges(); var message = Request.CreateResponse(HttpStatusCode.Created, driver_application); SendEmail(); message.Headers.Location = new Uri(Request.RequestUri + driver_application.ID.ToString()); return(message); } } catch (Exception ex) { return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex)); } }
public static void ResetEmailRecord(string sendmail) { using (cascadiaEntities cascadia_db = new cascadiaEntities()) { string IND_x = sendmail.ToString(); var IND_Value = '1'; string IND_Value_x = IND_Value.ToString(); var aventus = cascadia_db.tbl_web_driver_application.FirstOrDefault(e => e.MailSent == IND_x); if (aventus != null) { try { aventus.MailSent = IND_Value_x; cascadia_db.SaveChanges(); } catch (Exception ex) { Console.WriteLine("Exception caught in CreateTestMessage2(): {0}", ex.ToString()); } } } }