Example #1
0
        /// <summary>
        /// 新增分类
        /// </summary>
        /// <returns></returns>
        public ActionResult Create()
        {
            var model = new VmAdminTypeCreate();

            //model.商品类型名称 = "aaa"
            return(View(model));
        }
Example #2
0
        public ActionResult Create(VmAdminTypeCreate model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }
            //新增操作
            var newModel = new Models.EF.Type()
            {
                CosmeticType = model.CosmeticName
            };
            //存入数据库
            var da = new CosmeticsEntities();

            da.Type.Add(newModel);
            da.SaveChanges();

            //返回列表页
            return(RedirectToAction("index"));
        }