// GET: Admin/AdminSP public ActionResult Index() { if (TempData["Success"] != null) { ViewBag.Success = TempData["Success"].ToString(); } if (TempData["Error"] != null) { ViewBag.Error = TempData["Error"].ToString(); } return(View(MobileShopBus.DanhSachSP())); }
public ActionResult Edit(string id, SanPham sp) { { if (HttpContext.Request.Files.Count > 0) { var hpf = HttpContext.Request.Files[0]; if (hpf.ContentLength > 0) { string fileName = Guid.NewGuid().ToString(); string fullPathWithFileName = "/css/images/" + fileName + ".jpg"; hpf.SaveAs(Server.MapPath(fullPathWithFileName)); sp.HinhChinh = fullPathWithFileName; } } MobileShopBus.SuaSanPham(id, sp); return(RedirectToAction("Index")); } }
public ActionResult Create(SanPham sp) { //try //{ if (HttpContext.Request.Files.Count > 0) { var hpf = HttpContext.Request.Files[0]; if (hpf.ContentLength > 0) { string fileName = Guid.NewGuid().ToString(); string fullPathWithFileName = "/css/images/" + fileName + ".jpg"; hpf.SaveAs(Server.MapPath(fullPathWithFileName)); sp.Hinh1 = fileName + ".jpg"; } } MobileShopBus.ThemSP(sp); return(RedirectToAction("Index")); }
// GET: Shop/Details/5 public ActionResult Details(String id) { var sql = MobileShopBus.ChiTiet(id); return(View(sql)); }
// GET: San Pham public ActionResult Index(int PagedList = 1, int size = 6) { var dsSanPham = MobileShopBus.DanhSach().ToPagedList(PagedList, size); return(View(dsSanPham)); }
public ActionResult Index(int PagedList = 1, int size = 3) { var sql = MobileShopBus.DanhSachTOP10().ToPagedList(PagedList, size); return(View(sql)); }
//catch //{ // return View(); // GET: Admin/AdminSP/Edit/5 public ActionResult Edit(string id) { ViewBag.MaNhaSX = new SelectList(NhaSanXuatBus.DanhSach(), "MaNhaSX", "TenNhaSX"); ViewBag.MaLoaiSanPham = new SelectList(PhanLoaiBus.DanhSach(), "MaLoaiSP", "TenLoaiSP"); return(View(MobileShopBus.ChiTiet(id))); }
// GET: Admin/AdminSP/Delete/5 public ActionResult Delete(string id) { MobileShopBus.XoaTamSanPham(id); return(RedirectToAction("Index")); }