public ActionResult Create(FormCollection collection)
        {
            if (ModelState.IsValid)
            {
                var sp = new QuanLyShop();
                // TODO: Add insert logic here
                sp.tenShop = collection["tenShop"];
                sp.diaChi =  collection["diaChi"];
                sp.dienThoai = collection["dienThoai"];
                sp.sofax = collection["sofax"];
                sp.diemNoiBat = collection["diemNoiBat"];
                sp.tuKhoa = collection["tuKhoa"];
                sp.website = collection["website"];
                sp.huyen_ID = int.Parse(collection["huyen_ID"]);
                sp.tinhThanh_ID = int.Parse(collection["tinhThanh_ID"]);
                sp.ngayTao = DateTime.Now;
                sp.account_ID = 1;
                QLSHOPRes.Add(sp);
                QLSHOPRes.Save();

                InsertThoiGianHoatDongCuaShop(collection, sp.QLSHOP_ID);

                return RedirectToAction("Details", new { id = sp.QLSHOP_ID });

            }
            else
            {
                return View();
            }
        }
        public ActionResult Create()
        {
            if (Session["ID"] != null)
            {
                Session.Add("person", 1);
                var sp = new QuanLyShop();
                ViewData["TinhThanh"] = CMRes.FindAllTinhThanh();
                ViewData["QuanHuyen"] = CMRes.FindAllQuanHuyen();
                return View(sp);
            }
            else {
                Session.Add("UrlRedirect",Url.AbsoluteAction("Create","QuanLyShop"));
                return RedirectToAction("LogOn", "Account");

            }
        }
        public ActionResult Create(FormCollection collection)
        {
            if (Session["ID"] != null)
            {
                if (ModelState.IsValid)
                {
                    var sp = new QuanLyShop();
                    // TODO: Add insert logic here
                    int idAccount = int.Parse(Session["ID"].ToString());
                    sp.tenShop = collection["tenShop"];
                    sp.diaChi = collection["diaChi"];
                    sp.dienThoai = collection["dienThoai"];
                    sp.sofax = collection["sofax"];
                    sp.diemNoiBat = collection["diemNoiBat"];
                    sp.tuKhoa = collection["tuKhoa"];
                    sp.website = collection["website"];

                    if (collection["huyen_ID"] != "")
                    sp.huyen_ID = int.Parse(collection["huyen_ID"]);

                    sp.tinhThanh_ID = int.Parse(collection["tinhThanh_ID"]);
                    sp.ImageShop = collection["ImageShop"];
                    sp.ngayTao = DateTime.Now;
                    sp.account_ID = idAccount;
                    sp.TrangThai = "ChuaDuyet";

                    QLSHOPRes.Add(sp);
                    QLSHOPRes.Save();

                    InsertThoiGianHoatDongCuaShop(collection, sp.QLSHOP_ID, idAccount);

                    return RedirectToAction("Details", new { id = sp.QLSHOP_ID });

                }
                else
                {
                    return View();
                }
            }
            else {
                Session.Add("UrlRedirect", Url.AbsoluteAction("Create", "QuanLyShop"));
                return RedirectToAction("LogOn", "Account");
            }
        }
Esempio n. 4
0
 public void Delete(QuanLyShop dm)
 {
     en.DeleteObject(dm);
 }
Esempio n. 5
0
 public void Add(QuanLyShop dm)
 {
     en.AddObject("QuanLyShop", dm);
 }
 /// <summary>
 /// Deprecated Method for adding a new object to the QuanLyShops EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToQuanLyShops(QuanLyShop quanLyShop)
 {
     base.AddObject("QuanLyShops", quanLyShop);
 }
 /// <summary>
 /// Create a new QuanLyShop object.
 /// </summary>
 /// <param name="qLSHOP_ID">Initial value of the QLSHOP_ID property.</param>
 /// <param name="account_ID">Initial value of the account_ID property.</param>
 public static QuanLyShop CreateQuanLyShop(global::System.Decimal qLSHOP_ID, global::System.Decimal account_ID)
 {
     QuanLyShop quanLyShop = new QuanLyShop();
     quanLyShop.QLSHOP_ID = qLSHOP_ID;
     quanLyShop.account_ID = account_ID;
     return quanLyShop;
 }