public IHttpActionResult Puttbl_menu(int id, tbl_menu tbl_menu) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != tbl_menu.Menu_id) { return(BadRequest()); } db.Entry(tbl_menu).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!tbl_menuExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public ActionResult DeleteConfirmed(Guid id) { tbl_menu tbl_menu = db.tbl_menu.Find(id); db.tbl_menu.Remove(tbl_menu); db.SaveChanges(); return(RedirectToAction("Index")); }
public IHttpActionResult Gettbl_menu(int id) { tbl_menu tbl_menu = db.tbl_menu.Find(id); if (tbl_menu == null) { return(NotFound()); } return(Ok(tbl_menu)); }
public ActionResult Edit([Bind(Include = "type_id,dishes_id,is_active")] tbl_menu tbl_menu) { if (ModelState.IsValid) { db.Entry(tbl_menu).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.dishes_id = new SelectList(db.tbl_dishes, "id", "code", tbl_menu.dishes_id); ViewBag.type_id = new SelectList(db.tbl_menuType, "id", "name", tbl_menu.type_id); return(View(tbl_menu)); }
public IHttpActionResult Posttbl_menu(tbl_menu tbl_menu) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.tbl_menu.Add(tbl_menu); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = tbl_menu.Menu_id }, tbl_menu)); }
// GET: Menu/Details/5 public ActionResult Details(Guid?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } tbl_menu tbl_menu = db.tbl_menu.Find(id); if (tbl_menu == null) { return(HttpNotFound()); } return(View(tbl_menu)); }
public IHttpActionResult Deletetbl_menu(int id) { tbl_menu tbl_menu = db.tbl_menu.Find(id); if (tbl_menu == null) { return(NotFound()); } db.tbl_menu.Remove(tbl_menu); db.SaveChanges(); return(Ok(tbl_menu)); }
// GET: Menu/Edit/5 public ActionResult Edit(Guid?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } tbl_menu tbl_menu = db.tbl_menu.Find(id); if (tbl_menu == null) { return(HttpNotFound()); } ViewBag.dishes_id = new SelectList(db.tbl_dishes, "id", "code", tbl_menu.dishes_id); ViewBag.type_id = new SelectList(db.tbl_menuType, "id", "name", tbl_menu.type_id); return(View(tbl_menu)); }