예제 #1
0
        /// <summary>
        /// 食物搭配修改页面
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ActionResult FoodDapeiPageUpdate(int id)
        {
            dapei dd = db.dapei.SingleOrDefault <dapei>(d => d.id == id);

            ViewData["dapei"] = dd;
            return(View());
        }
예제 #2
0
        /// <summary>
        /// 食物搭配删除业务实现
        /// </summary>
        /// <param name="id">搭配Id</param>
        /// <returns></returns>
        public ActionResult FoodDapeiPageDeleteRequest(int id)
        {
            dapei dd = db.dapei.SingleOrDefault <dapei>(d => d.id == id);

            db.dapei.DeleteObject(dd);
            db.SaveChanges();
            return(Redirect("/food/FoodDapeiPage"));
        }
예제 #3
0
        /// <summary>
        /// 食物搭配修改业务
        /// </summary>
        /// <param name="id">搭配id</param>
        /// <param name="dp">搭配内容</param>
        /// <returns></returns>
        public ActionResult FoodDapeiPageUpdateRequest(int id, String dp)
        {
            dapei dd = db.dapei.SingleOrDefault <dapei>(d => d.id == id);

            dd.dp = dp;
            db.SaveChanges();
            return(Redirect("/food/FoodDapeiPage"));
        }
예제 #4
0
        /// <summary>
        /// 添加食物搭配业务
        /// </summary>
        /// <param name="dp">搭配内容</param>
        /// <returns></returns>
        public ActionResult FoodDapeiPageAddRequest(String dp)
        {
            user_table u = checkUser();
            dapei      d = new dapei();

            d.uid = u.id;
            d.fid = u.fid;
            d.dp  = dp;
            db.dapei.AddObject(d);
            int row = db.SaveChanges();

            return(Json(row, JsonRequestBehavior.AllowGet));
        }