public IHttpActionResult PutWineCatalogModel(int id, WineCatalogModel wineCatalogModel)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

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

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

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

            return StatusCode(HttpStatusCode.NoContent);
        }
        public IHttpActionResult PutWineCatalogModel(int id, WineCatalogModel wineCatalogModel)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
        public ActionResult DeleteConfirmed(int id)
        {
            WineCatalogModel wineCatalogModel = db.WineCatalogs.Find(id);

            db.WineCatalogs.Remove(wineCatalogModel);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 public ActionResult Edit([Bind(Include = "Id,Title,Color,TermExposure,Fortress,Price")] WineCatalogModel wineCatalogModel)
 {
     if (ModelState.IsValid)
     {
         db.Entry(wineCatalogModel).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(wineCatalogModel));
 }
        public ActionResult Create([Bind(Include = "Id,Title,Color,TermExposure,Fortress,Price")] WineCatalogModel wineCatalogModel)
        {
            if (ModelState.IsValid)
            {
                db.WineCatalogs.Add(wineCatalogModel);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(wineCatalogModel));
        }
        public IHttpActionResult GetWineCatalogModel(int id)
        {
            WineCatalogModel wineCatalogModel = db.WineCatalogs.Find(id);

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

            return(Ok(wineCatalogModel));
        }
        public IHttpActionResult PostWineCatalogModel(WineCatalogModel wineCatalogModel)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            db.WineCatalogs.Add(wineCatalogModel);
            db.SaveChanges();

            return CreatedAtRoute("DefaultApi", new { id = wineCatalogModel.Id }, wineCatalogModel);
        }
        public IHttpActionResult PostWineCatalogModel(WineCatalogModel wineCatalogModel)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.WineCatalogs.Add(wineCatalogModel);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = wineCatalogModel.Id }, wineCatalogModel));
        }
        // GET: WineCatalog/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            WineCatalogModel wineCatalogModel = db.WineCatalogs.Find(id);

            if (wineCatalogModel == null)
            {
                return(HttpNotFound());
            }
            return(View(wineCatalogModel));
        }
        public IHttpActionResult DeleteWineCatalogModel(int id)
        {
            WineCatalogModel wineCatalogModel = db.WineCatalogs.Find(id);

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

            db.WineCatalogs.Remove(wineCatalogModel);
            db.SaveChanges();

            return(Ok(wineCatalogModel));
        }