Пример #1
0
        public IHttpActionResult PostRecord0136(Record0136 record0136)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.Record0136.Add(record0136);

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateException)
            {
                if (Record0136Exists(record0136.RecordID))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtRoute("DefaultApi", new { id = record0136.RecordID }, record0136));
        }
Пример #2
0
        public IHttpActionResult PutRecord0136(string id, Record0136 record0136)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != record0136.RecordID)
            {
                return(BadRequest());
            }

            db.Entry(record0136).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!Record0136Exists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Пример #3
0
        public IHttpActionResult GetRecord0136(string id)
        {
            Record0136 record0136 = db.Record0136.Find(id);

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

            return(Ok(record0136));
        }
Пример #4
0
        public IHttpActionResult DeleteRecord0136(string id)
        {
            Record0136 record0136 = db.Record0136.Find(id);

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

            db.Record0136.Remove(record0136);
            db.SaveChanges();

            return(Ok(record0136));
        }