public ActionResult chinh_sua_sp(int id, FormCollection fc) { Product p = new Product(); p.Id = id; p.Images = fc["image"]; p.Name = fc["name"]; p.Price = Convert.ToDouble(fc["price"]); p.Content = fc["content"]; p.Type = Convert.ToInt32(fc["type"]); p.Quantity = Convert.ToInt32(fc["quantity"]); DAOProduct dao = new DAOProduct(); if (dao.Update_product(p, id)) { new DaoLog().INFO("success", "chinh_sua_sp"); } else { new DaoLog().INFO("fail", "chinh_sua_sp"); } TempData["msg"] = "UPDATE SUCCESS"; return(RedirectToAction("danh_sach_sp", "Admin")); }
public ActionResult chinh_sua_sp(int id) { DAOProduct dao = new DAOProduct(); DataSet ds = dao.show_record_byid(id); ViewBag.updateSP = ds.Tables[0]; return(View()); }
public static void printInventory() { string sql = $"SELECT * FROM \"Product\""; var table = DAOProduct.AllProducts(sql, false); var printTable = new ConsoleTable("ProductID", "ProductName", "Quantity", "Price"); foreach (List <string> list in table) { printTable.AddRow(list[0], list[1], list[2], list[3]); } printTable.Write(); }
public ActionResult danh_sach_sp(int?page) { if (page == null) { page = 1; } List <Product> pages = DAOProduct.getPage(page); int pageSize = 12; int pageNumber = (page ?? 1); return(View(pages.ToPagedList(pageNumber, pageSize))); }
public ActionResult xoa_loai_sp(int id) { if (DAOProduct.delProductType(id)) { new DaoLog().WARNING("success", "xoa_loai_sp"); } else { new DaoLog().WARNING("fail", "xoa_loai_sp"); } return(RedirectToAction("ql_loai_sp", "Admin")); }
public ActionResult xoa_sp(int id) { DAOProduct dao = new DAOProduct(); if (dao.delete(id)) { new DaoLog().WARNING("success", "xoa_sp"); } else { new DaoLog().WARNING("fail", "xoa_sp"); } return(RedirectToAction("danh_sach_sp", "Admin")); }
public ActionResult them_loai_sp(FormCollection formCollection) { // int id = Convert.ToInt32(formCollection["id"]); string name = formCollection["name"]; ProductType productType = new ProductType(name); if (DAOProduct.addProductType(productType)) { new DaoLog().INFO("success", "them_loai_sp"); return(RedirectToAction("ql_loai_sp", "Admin")); } else { new DaoLog().INFO("fail", "them_loai_sp"); ViewBag.error = "add product type not success"; return(View()); } }
public ActionResult chinh_sua_loaiSP(FormCollection formCollection) { int id = Convert.ToInt32(formCollection["id"]); string name = formCollection["name"]; int active = Convert.ToInt32(formCollection["active"]); ProductType productType = new ProductType(id, name, active); if (DAOProduct.editProductType(productType)) { new DaoLog().INFO("success", "chinh_sua_loaiSP"); return(RedirectToAction("ql_loai_sp", "Admin")); } else { new DaoLog().INFO("fail", "chinh_sua_loaiSP"); ViewBag.error = "edit product type not success"; return(View()); } }
public ActionResult loai_sp(int?type) { List <Product> list = DAOProduct.Product_type(type); return(View(list)); }
public ActionResult chinh_sua_loaiSP(int id) { ProductType productType = DAOProduct.getProductType(id); return(View(productType)); }
public ActionResult ql_loai_sp() { List <ProductType> list = DAOProduct.getListProductType(); return(View(list)); }