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"); } }
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(); } }
// // 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"); } }
public void Delete(DanhMucCuaShop dm) { en.DeleteObject(dm); }
public void Add(DanhMucCuaShop dm) { var q = (from p in en.DanhMucCuaShop select p.ID).Max(); dm.ID = q + 1; en.AddObject("DanhMucCuaShop", dm); }
// // GET: /DanhMucCuaShop/Create public ActionResult Create() { var dm = new DanhMucCuaShop(); return View(dm); }
/// <summary> /// Deprecated Method for adding a new object to the DanhMucCuaShop EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToDanhMucCuaShop(DanhMucCuaShop danhMucCuaShop) { base.AddObject("DanhMucCuaShop", danhMucCuaShop); }
/// <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; }