예제 #1
0
        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));
        }
예제 #2
0
        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"));
        }
예제 #3
0
        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));
        }
예제 #4
0
 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));
 }
예제 #5
0
        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));
        }
예제 #6
0
        // 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));
        }
예제 #7
0
        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));
        }
예제 #8
0
        // 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));
        }