public IHttpActionResult PutSystem_Logging(int id, System_Logging system_Logging) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != system_Logging.Id) { return(BadRequest()); } db.Entry(system_Logging).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!System_LoggingExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult GetSystem_Logging(int id) { System_Logging system_Logging = db.System_Logging.Find(id); if (system_Logging == null) { return(NotFound()); } return(Ok(system_Logging)); }
public IHttpActionResult PostSystem_Logging([FromBody] System_Logging system_Logging) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } try { var syslog = new System_Logging { Id = 0, EnteredDate = system_Logging.EnteredDate, logMessage = '@' + system_Logging.logMessage.ToString(), logRouteInfo = system_Logging.logRouteInfo, loguserName = system_Logging.loguserName != null ? system_Logging.loguserName : "******" }; db.System_Logging.Add(syslog); db.SaveChanges(); var client = new SendGridClient("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"); var msg = new SendGrid.Helpers.Mail.SendGridMessage() { From = new EmailAddress("*****@*****.**"), Subject = "HLAPointErrorNotification<DonotReply>", PlainTextContent = "HLAPointErrorNotification", HtmlContent = "<strong>ErrorReportedFor :</strong>" + syslog.loguserName + "</br>" + "<strong>Resource Accessed :</strong>" + system_Logging.logRouteInfo + "</br>" + "<strong>ErrorDetails :</strong>" + system_Logging.logMessage + "</br>" }; //var emailst = new List<EmailAddress>(); //var emailaddr1 = new EmailAddress("*****@*****.**"); //emailst.Add(emailaddr1); //var emailaddr2 = new EmailAddress("*****@*****.**"); //emailst.Add(emailaddr1); //msg.AddTos(emailst); msg.AddTo(new EmailAddress("*****@*****.**", "Test User")); var response = client.SendEmailAsync(msg); return(CreatedAtRoute("DefaultApi", new { id = system_Logging.Id }, system_Logging)); } catch (Exception ex) { return(Json(ex)); } }
public IHttpActionResult DeleteSystem_Logging(int id) { System_Logging system_Logging = db.System_Logging.Find(id); if (system_Logging == null) { return(NotFound()); } db.System_Logging.Remove(system_Logging); db.SaveChanges(); return(Ok(system_Logging)); }