// PUT api/PremiumCalculator/5 public IHttpActionResult PutCalculatorLog(int id, CalculatorLog calculatorlog) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != calculatorlog.Id) { return(BadRequest()); } db.Entry(calculatorlog).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!CalculatorLogExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult GetCalculatorLog(int id) { CalculatorLog calculatorlog = db.CalculatorLogs.Find(id); if (calculatorlog == null) { return(NotFound()); } return(Ok(calculatorlog)); }
public IHttpActionResult PostCalculatorLog(CalculatorLog calculatorlog) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.CalculatorLogs.Add(calculatorlog); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = calculatorlog.Id }, calculatorlog)); }
public IHttpActionResult DeleteCalculatorLog(int id) { CalculatorLog calculatorlog = db.CalculatorLogs.Find(id); if (calculatorlog == null) { return(NotFound()); } db.CalculatorLogs.Remove(calculatorlog); db.SaveChanges(); return(Ok(calculatorlog)); }