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

            if (id != carStock.Id)
            {
                return(BadRequest());
            }

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
Пример #2
0
        public IHttpActionResult GetCarStock(int id)
        {
            CarStock carStock = db.CarStock.Find(id);

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

            return(Ok(carStock));
        }
Пример #3
0
        public IHttpActionResult PostCarStock(CarStock carStock)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.CarStock.Add(carStock);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = carStock.Id }, carStock));
        }
Пример #4
0
        public IHttpActionResult DeleteCarStock(int id)
        {
            CarStock carStock = db.CarStock.Find(id);

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

            db.CarStock.Remove(carStock);
            db.SaveChanges();

            return(Ok(carStock));
        }
Пример #5
0
 private void detach_CarStocks(CarStock entity)
 {
     this.SendPropertyChanging();
     entity.CarModel = null;
 }
Пример #6
0
 private void attach_CarStocks(CarStock entity)
 {
     this.SendPropertyChanging();
     entity.CarModel = this;
 }
Пример #7
0
 partial void DeleteCarStock(CarStock instance);
Пример #8
0
 partial void UpdateCarStock(CarStock instance);
Пример #9
0
 partial void InsertCarStock(CarStock instance);