public IHttpActionResult PutOrder(int id, OrderSet orderSet) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != orderSet.IdOrder) { return(BadRequest()); } db.Entry(orderSet).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!OrderSetExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public ActionResult Edit([Bind(Include = "ID,Name,Price,quantity")] ProductModel productModel) { if (ModelState.IsValid) { db.Entry(productModel).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(productModel)); }
public ActionResult Edit([Bind(Include = "Id,SessionId,Name,Phone,Address,Image")] Restaurant restaurant) { if (ModelState.IsValid) { db.Entry(restaurant).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.SessionId = new SelectList(db.Sessions, "Id", "Id", restaurant.SessionId); return(View(restaurant)); }
public ActionResult Edit([Bind(Include = "Id,Name,RestaurantId,Icon")] Category category) { if (ModelState.IsValid) { db.Entry(category).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.RestaurantId = new SelectList(db.Restaurants, "Id", "Name", category.RestaurantId); return(View(category)); }
public ActionResult Edit([Bind(Include = "Id,Name,Image,Price,CategoryId,RestaurantId")] Food food) { if (ModelState.IsValid) { db.Entry(food).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.CategoryId = new SelectList(db.Categories, "Id", "Name", food.CategoryId); ViewBag.RestaurantId = new SelectList(db.Restaurants, "Id", "Name", food.RestaurantId); return(View(food)); }
// POST api/<controller> public void Post([FromBody] List <string> value) { Review objReview = new Review(); objReview.Reviews_Id = Convert.ToInt16(value[0].ToString()); objReview.Rating = Convert.ToInt64(value[1].ToString()); objReview.Comment = value[2].ToString(); objReview.User = value[3].ToString(); objReview.Product_Id = Convert.ToInt16(value[4].ToString()); context.Reviews.Add(objReview); context.Entry(objReview).State = System.Data.EntityState.Modified; context.SaveChanges(); }