Пример #1
0
        public IHttpActionResult PutShopB(string id, ShopB shopB)
        {
            if (id != shopB.Name)
            {
                return(BadRequest());
            }

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
Пример #2
0
        public IHttpActionResult DeleteShopB(string id)
        {
            ShopB shopB = db.ShopBs.Find(id);

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

            db.ShopBs.Remove(shopB);
            db.SaveChanges();

            return(Ok(shopB));
        }
Пример #3
0
        public IHttpActionResult PostShopB(ShopB shopB)
        {
            db.ShopBs.Add(shopB);

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateException)
            {
                if (ShopBExists(shopB.Name))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtRoute("DefaultApi", new { id = shopB.Name }, shopB));
        }