Пример #1
0
        public IHttpActionResult Put(int id, BRelationSize bRelationSize)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != bRelationSize.relation_id)
            {
                return(BadRequest());
            }

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
Пример #2
0
        public IHttpActionResult Get(int id)
        {
            BRelationSize bRelationSize = db.BRelationSizes.Find(id);

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

            return(Ok(bRelationSize));
        }
Пример #3
0
        public IHttpActionResult Post(BRelationSize bRelationSize)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.BRelationSizes.Add(bRelationSize);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = bRelationSize.relation_id }, bRelationSize));
        }
Пример #4
0
        public IHttpActionResult Delete(int id)
        {
            BRelationSize bRelationSize = db.BRelationSizes.Find(id);

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

            db.BRelationSizes.Remove(bRelationSize);
            db.SaveChanges();

            return(Ok(bRelationSize));
        }