public IHttpActionResult PutTRANSACTION_LOG(decimal id, TRANSACTION_LOG tRANSACTION_LOG) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != tRANSACTION_LOG.TRANSACTION_ID) { return(BadRequest()); } db.Entry(tRANSACTION_LOG).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!TRANSACTION_LOGExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.Accepted)); }
public IHttpActionResult GetTRANSACTION_LOG(decimal id) { TRANSACTION_LOG tRANSACTION_LOG = db.TRANSACTION_LOG.Find(id); if (tRANSACTION_LOG == null) { return(NotFound()); } return(Ok(tRANSACTION_LOG)); }
public IHttpActionResult DeleteTRANSACTION_LOG(decimal id) { TRANSACTION_LOG tRANSACTION_LOG = db.TRANSACTION_LOG.Find(id); if (tRANSACTION_LOG == null) { return(NotFound()); } db.TRANSACTION_LOG.Remove(tRANSACTION_LOG); db.SaveChanges(); return(Ok(tRANSACTION_LOG)); }
public IHttpActionResult PostTRANSACTION_LOG(TRANSACTION_LOG tRANSACTION_LOG) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.TRANSACTION_LOG.Add(tRANSACTION_LOG); try { db.SaveChanges(); } catch (DbEntityValidationException e) { foreach (var eve in e.EntityValidationErrors) { Debug.WriteLine("Entity of type \"{0}\" in state \"{1}\" has the following validation errors:", eve.Entry.Entity.GetType().Name, eve.Entry.State); foreach (var ve in eve.ValidationErrors) { Debug.WriteLine("- Property: \"{0}\", Error: \"{1}\"", ve.PropertyName, ve.ErrorMessage); } } throw; } catch (DbUpdateException) { if (TRANSACTION_LOGExists(tRANSACTION_LOG.TRANSACTION_ID)) { return(Conflict()); } else { throw; } } return(CreatedAtRoute("DefaultApi", new { id = tRANSACTION_LOG.TRANSACTION_ID }, tRANSACTION_LOG)); }