Beispiel #1
0
 public ActionResult Update(MProductVM model)
 {
     if (ModelState.IsValid)
     {
         if (MProductRepo.CheckIfExists(model) == true)
         {
             var notif = new
             {
                 success      = false,
                 alertType    = "error",
                 alertMessage = "ERROR !",
                 alertStrong  = "Your Data With Name (" + model.name + ") is Already Exists"
             };
             return(Json(notif, JsonRequestBehavior.AllowGet));
         }
         else
         {
             MProductRepo.Update(model);
             var result = new
             {
                 success      = true,
                 alertType    = "info",
                 alertMessage = "Updated !",
                 alertStrong  = "Your Data With Code <strong>(" + model.code + ")</strong> is Updated"
             };
             return(Json(result, JsonRequestBehavior.AllowGet));
         }
     }
     return(PartialView("_Update"));
 }
Beispiel #2
0
        public ActionResult Detail(int id)
        {
            var jsonParse = new
            {
                data = MProductRepo.GetId(id)
            };

            Json(jsonParse, JsonRequestBehavior.AllowGet);

            return(PartialView("_Detail", jsonParse.data));
        }
Beispiel #3
0
        public ActionResult Delete(int id)
        {
            var data = MProductRepo.GetId(id);

            MProductRepo.Delete(id);
            var result = new
            {
                success      = true,
                item         = data,
                alertType    = "info",
                alertMessage = "Deleted !",
                alertStrong  = "Your Data With Code <strong>(" + data.code + ")</strong> is Deleted"
            };

            return(Json(result, JsonRequestBehavior.AllowGet));
        }
Beispiel #4
0
 public ActionResult Update(int id)
 {
     return(PartialView("_Update", MProductRepo.GetId(id)));
 }
Beispiel #5
0
 public ActionResult Insert()
 {
     ViewBag.AutoCode = MProductRepo.AutoCode();
     return(PartialView("_Insert"));
 }
Beispiel #6
0
        public ActionResult List()
        {
            var data = MProductRepo.GetAllData();

            return(PartialView("_List", data));
        }
Beispiel #7
0
        // GET: MProduct
        public ActionResult Index()
        {
            var data = MProductRepo.GetAllData();

            return(View(data));
        }