public IHttpActionResult PutWine(int id, Wine wine) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != wine.Id) { return(BadRequest()); } db.Entry(wine).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!WineExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult PutTTBActiveWinePermitModel(string id, TTBActiveWinePermitModel tTBActiveWinePermitModel) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != tTBActiveWinePermitModel.PERMIT_NUMBER) { return(BadRequest()); } db.Entry(tTBActiveWinePermitModel).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!TTBActiveWinePermitModelExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public ActionResult Edit([Bind(Include = "WineID,Name,Vineyard,Description,ImageURL,BottlePrice,CasePrice,Grape")] Wine wine) { if (ModelState.IsValid) { db.Entry(wine).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(wine)); }