public ActionResult MainMenu()
        {
            var dao   = new TypeProductDao();
            var model = dao.ListAllTypeProduct();

            return(PartialView(model));
        }
Beispiel #2
0
        public ActionResult EditTypeProduct(long id)
        {
            var dao   = new TypeProductDao();
            var model = dao.GetTypeProduct(id);

            return(View(model));
        }
Beispiel #3
0
        public ActionResult DeleteTypeProduct(long id)
        {
            var dao = new TypeProductDao();

            dao.DeleteTypeProduct(id);
            TempData["success"] = "Deleted Success";
            return(RedirectToAction("Index", "TypeProduct"));
        }
Beispiel #4
0
 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"));
     }
 }
Beispiel #5
0
 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"));
     }
 }