// // GET: /quanLySanPham/Create public ActionResult Create() { var sp = new quanLySanPham(); ViewData["DanhMucCuaShop"] = DMRes.FindAllDanhMucCuaShop(); ViewData["TinhThanh"] = CMRes.FindAllTinhThanh(); ViewData["NganhHang"] = CMRes.FindAllNganhHang(); return View(sp); }
public ActionResult Create(FormCollection collection) { // TODO: Add insert logic here if (ModelState.IsValid) { var sp = new quanLySanPham(); // TODO: Add insert logic here sp.tenSanPham = collection["tenSanPham"]; sp.giaGoc = float.Parse(collection["giaGoc"]); sp.giaThamKhao = Convert.ToInt64(collection["giaThamKhao"]); sp.hinhAnh = collection["hinhAnh"]; sp.diemNoiBat = collection["diemNoiBat"]; sp.nganhHang_ID = int.Parse(collection["nganhHang_ID"]); sp.tuKhoaSanPham = collection["tuKhoaSanPham"]; sp.huyen_ID = int.Parse(collection["huyen_ID"]); sp.danhMucCuaShop_ID = int.Parse(collection["danhMucCuaShop_ID"]); sp.website = collection["website"]; sp.noidung = collection["noidung"]; sp.ngayTao = DateTime.Now; //sp.quan_ID = int.Parse(collection["quan_ID"]); //sp.SoNguoiXem = int.Parse(collection["SoNguoiXem"]); sp.QLSHOP_ID = 1; sp.account_ID = 1; sp.trangThai = "Chưa duyệt"; QLSPRes.Add(sp); QLSPRes.Save(); return RedirectToAction("Details", new {id=sp.QLSP_ID }); } else { return View(); } }
/// <summary> /// Create a new quanLySanPham object. /// </summary> /// <param name="qLSP_ID">Initial value of the QLSP_ID property.</param> /// <param name="ngayTao">Initial value of the ngayTao property.</param> public static quanLySanPham CreatequanLySanPham(global::System.Int32 qLSP_ID, global::System.DateTime ngayTao) { quanLySanPham quanLySanPham = new quanLySanPham(); quanLySanPham.QLSP_ID = qLSP_ID; quanLySanPham.ngayTao = ngayTao; return quanLySanPham; }
/// <summary> /// Deprecated Method for adding a new object to the quanLySanPham EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToquanLySanPham(quanLySanPham quanLySanPham) { base.AddObject("quanLySanPham", quanLySanPham); }
public ActionResult Create(FormCollection collection) { if (Session["ID"] != null) { // TODO: Add insert logic here if (ModelState.IsValid) { var sp = new quanLySanPham(); // TODO: Add insert logic here sp.tenSanPham = collection["tenSanPham"]; sp.giaGoc = float.Parse(collection["giaGoc"]); sp.giaThamKhao = Convert.ToInt64(collection["giaThamKhao"]); sp.hinhAnh = collection["hinhAnh"]; sp.diemNoiBat = collection["diemNoiBat"]; sp.nganhHang_ID = int.Parse(collection["nganhHang_ID"]); sp.tuKhoaSanPham = collection["tuKhoaSanPham"]; sp.huyen_ID = int.Parse(collection["huyen_ID"]); if (collection["danhMucCuaShop_ID"] !="") sp.danhMucCuaShop_ID = int.Parse(collection["danhMucCuaShop_ID"]); sp.website = collection["website"]; sp.noidung = collection["noidung"]; sp.ngayTao = DateTime.Now; sp.NgayUpDate = DateTime.Now; //sp.quan_ID = int.Parse(collection["quan_ID"]); //sp.SoNguoiXem = int.Parse(collection["SoNguoiXem"]); sp.QLSHOP_ID = 1; sp.account_ID = int.Parse(Session["ID"].ToString()); sp.trangThai = "Chưa duyệt"; if (collection["PreviewSubmitName"] == null && collection["PreviewBack"] == null) { QLSPRes.Add(sp); QLSPRes.Save(); if (collection["SaveSubmitName"] != null) { return RedirectToAction("Details", new { id = sp.QLSP_ID }); } else if (collection["AddSubmitName"] != null) { return RedirectToAction("Create"); } else if (collection["PreviewBack"] != null) { return View("Create", sp); } else { return View(); } } if (collection["PreviewSubmitName"] != null) { return View("Preview", sp); } else if (collection["PreviewBack"] != null) { ViewData["DanhMucCuaShop"] = DMRes.FindAllDanhMucCuaShop(); ViewData["TinhThanh"] = CMRes.FindAllTinhThanh(); ViewData["NganhHang"] = this.GetSelectedAllNganhhang(0); return View("Create", sp); } else { return View(); } } else { return View(); } } else { Session.Add("UrlRedirect", Url.AbsoluteAction("Create", "quanLySanPham")); return RedirectToAction("LogOn", "Account"); } }
// // GET: /quanLySanPham/Create public ActionResult Create() { if (Session["ID"] != null) { var sp = new quanLySanPham(); ViewData["DanhMucCuaShop"] = DMRes.FindAllDanhMucCuaShop(); ViewData["TinhThanh"] = CMRes.FindAllTinhThanh(); ViewData["NganhHang"] = this.GetSelectedAllNganhhang(0); return View(sp); } else { return RedirectToAction("LogOn", "Account"); } }
// // GET: /quanLySanPham/Create public ActionResult Create() { if (Session["ID"] != null) { var sp = new quanLySanPham(); ViewData["DanhMucCuaShop"] = getDanhMucCuaShop(int.Parse(Session["ID"].ToString()),0); ViewData["TinhThanh"] = CMRes.FindAllTinhThanh(); ViewData["NganhHang"] = this.GetSelectedAllNganhhang(0); return View(sp); } else { Session.Add("UrlRedirect", Url.AbsoluteAction("Create", "quanLySanPham")); return RedirectToAction("LogOn", "Account"); } }
public void Delete(quanLySanPham dm) { en.DeleteObject(dm); }
public void Add(quanLySanPham dm) { //var q = (from p in en.quanLySanPham select p.QLSP_ID).Max(); //dm.QLSP_ID = q + 1; en.AddObject("quanLySanPham", dm); }