Ejemplo n.º 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"));
 }