コード例 #1
0
        public ActionResult Create([Bind(Include = "C_id_cooking_stages,C_id_dish,C_text")] COOKING_STAGES cOOKING_STAGES)
        {
            if (ModelState.IsValid)
            {
                db.COOKING_STAGES.Add(cOOKING_STAGES);
                db.SaveChanges();
                return(RedirectToAction("Create"));
            }

            ViewBag.C_id_dish = new SelectList(db.BOOK_DISH, "C_id_dish", "name_dish", cOOKING_STAGES.C_id_dish);
            return(View(cOOKING_STAGES));
        }
コード例 #2
0
        public ActionResult Create([Bind(Include = "C_id_ingred,name_ingredient,id_unit_measure")] INGREDIENT iNGREDIENT)
        {
            if (ModelState.IsValid)
            {
                db.INGREDIENTs.Add(iNGREDIENT);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.id_unit_measure = new SelectList(db.UNIT_MEASURE, "id_unit_measure", "name_unit_measure", iNGREDIENT.id_unit_measure);
            return(View(iNGREDIENT));
        }
コード例 #3
0
        public ActionResult Create([Bind(Include = "C_id,C_id_ingred,C_id_dish,kol")] RECIPE rECIPE)
        {
            if (ModelState.IsValid)
            {
                db.RECIPEs.Add(rECIPE);
                db.SaveChanges();
                return(RedirectToAction("Create"));
            }

            ViewBag.C_id_dish   = new SelectList(db.BOOK_DISH, "C_id_dish", "name_dish", rECIPE.C_id_dish);
            ViewBag.C_id_ingred = new SelectList(db.INGREDIENTs, "C_id_ingred", "name_ingredient", rECIPE.C_id_ingred);
            return(View(rECIPE));
        }
コード例 #4
0
        public ActionResult Create([Bind(Include = "C_id_dish,name_dish,time_pr,C_id_cuisine_national,C_id_cooking_method,C_id_type_dish,C_id_cuisine_type,calories,imageData")] BOOK_DISH bOOK_DISH)
        {
            if (ModelState.IsValid)
            {
                db.BOOK_DISH.Add(bOOK_DISH);
                db.SaveChanges();
                return(RedirectToAction("../RECIPEs/Create"));
            }

            ViewBag.C_id_cooking_method   = new SelectList(db.COOKING_METHOD, "C_id_cooking_method", "name_method", bOOK_DISH.C_id_cooking_method);
            ViewBag.C_id_cuisine_national = new SelectList(db.CUISINE_NATIONAL, "C_id_cuisine_national", "name_cuisine", bOOK_DISH.C_id_cuisine_national);
            ViewBag.C_id_cuisine_type     = new SelectList(db.CUISINE_TYPE, "C_id_cuisine_type", "name_cuisine", bOOK_DISH.C_id_cuisine_type);
            ViewBag.C_id_type_dish        = new SelectList(db.TYPE_DISH, "C_id_type_dish", "name_type", bOOK_DISH.C_id_type_dish);
            return(View(bOOK_DISH));
        }