public ActionResult MainMenu() { var dao = new TypeProductDao(); var model = dao.ListAllTypeProduct(); return(PartialView(model)); }
public ActionResult EditTypeProduct(long id) { var dao = new TypeProductDao(); var model = dao.GetTypeProduct(id); return(View(model)); }
public ActionResult DeleteTypeProduct(long id) { var dao = new TypeProductDao(); dao.DeleteTypeProduct(id); TempData["success"] = "Deleted Success"; return(RedirectToAction("Index", "TypeProduct")); }
public ActionResult AddTypeProduct(type_products TypeProduct) { if (ModelState.IsValid) { TypeProduct.created_at = DateTime.Now; var dao = new TypeProductDao(); var model = dao.AddTypeProduct(TypeProduct); TempData["success"] = "Add Success"; return(RedirectToAction("Index")); } else { ModelState.AddModelError("", "Fail"); return(RedirectToAction("Index")); } }
public ActionResult EditTypeProduct(type_products TypeProduct) { if (ModelState.IsValid) { var dao = new TypeProductDao(); var CreatedAt = dao.GetTypeProduct(TypeProduct.id).created_at; TypeProduct.created_at = CreatedAt; TypeProduct.updated_at = DateTime.Now; dao.EditTypeProduct(TypeProduct); TempData["success"] = "Edited Successfully"; return(RedirectToAction("Index")); } else { ModelState.AddModelError("", "Fail Edit"); return(View("Index")); } }