コード例 #1
0
        public ActionResult Create(FormCollection collection)
        {
            if (Session["ID"] != null)
            {
                QuanLyShop shop = QLSHOPRes.GetShopByAccount(int.Parse(Session["ID"].ToString()));
                if (shop != null)
                {
                    if (ModelState.IsValid)
                    {
                        var dm = new DanhMucCuaShop();
                        // TODO: Add insert logic here
                        dm.tenDanhMuc = collection["tenDanhMuc"];

                        dm.QLSHOP_ID = shop.QLSHOP_ID;
                        res.Add(dm);
                        res.Save();
                        return RedirectToAction("List");

                    }
                    else
                    {
                        ModelState.AddModelError("", "Bạn chưa có Shop");
                        return View();
                    }
                }
                else {
                    return View();
                }
            }
            else {
                Session.Add("UrlRedirect", Url.AbsoluteAction("Create", "DanhMucCuaShop"));
                return RedirectToAction("LogOn", "Account");
            }
        }
コード例 #2
0
        public ActionResult Create(FormCollection collection)
        {
            if (ModelState.IsValid)
            {
                var dm = new DanhMucCuaShop();
                // TODO: Add insert logic here
                dm.tenDanhMuc = collection["tenDanhMuc"];
                dm.QLSHOP_ID = 1;
                res.Add(dm);
                res.Save();
                return RedirectToAction("List");

            }
            else {

                return View();
            }
        }
コード例 #3
0
 //
 // GET: /DanhMucCuaShop/Create
 public ActionResult Create()
 {
     if (Session["ID"] != null)
     {
         QuanLyShop shop = QLSHOPRes.GetShopByAccount(int.Parse(Session["ID"].ToString()));
         if (shop == null)
         {
             ModelState.AddModelError("", "Bạn phải tạo shop trước khi tạo danh mục shop");
             return View();
         }
         else
         {
             var dm = new DanhMucCuaShop();
             return View(dm);
         }
     }
     else {
         Session.Add("UrlRedirect", Url.AbsoluteAction("Create", "DanhMucCuaShop"));
         return RedirectToAction("LogOn", "Account");
     }
 }
コード例 #4
0
 public void Delete(DanhMucCuaShop dm)
 {
     en.DeleteObject(dm);
 }
コード例 #5
0
 public void Add(DanhMucCuaShop dm)
 {
     var q = (from p in en.DanhMucCuaShop select p.ID).Max();
     dm.ID = q + 1;
     en.AddObject("DanhMucCuaShop", dm);
 }
コード例 #6
0
 //
 // GET: /DanhMucCuaShop/Create
 public ActionResult Create()
 {
     var dm = new DanhMucCuaShop();
     return View(dm);
 }
コード例 #7
0
 /// <summary>
 /// Deprecated Method for adding a new object to the DanhMucCuaShop EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToDanhMucCuaShop(DanhMucCuaShop danhMucCuaShop)
 {
     base.AddObject("DanhMucCuaShop", danhMucCuaShop);
 }
コード例 #8
0
 /// <summary>
 /// Create a new DanhMucCuaShop object.
 /// </summary>
 /// <param name="id">Initial value of the ID property.</param>
 public static DanhMucCuaShop CreateDanhMucCuaShop(global::System.Int32 id)
 {
     DanhMucCuaShop danhMucCuaShop = new DanhMucCuaShop();
     danhMucCuaShop.ID = id;
     return danhMucCuaShop;
 }