Exemple #1
0
        // 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));
        }
Exemple #2
0
        public IHttpActionResult GetCalculatorLog(int id)
        {
            CalculatorLog calculatorlog = db.CalculatorLogs.Find(id);

            if (calculatorlog == null)
            {
                return(NotFound());
            }

            return(Ok(calculatorlog));
        }
Exemple #3
0
        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));
        }
Exemple #4
0
        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));
        }