示例#1
0
 public ActionResult CreateEdit(SupplierViewModel model)
 {
     try
     {
         if (ModelState.IsValid)
         {
             if (SupplierDataAccess.Update(model))
             {
                 return(Json(new { success = true, message = "berhasil" }, JsonRequestBehavior.AllowGet));
             }
             else
             {
                 return(Json(new { success = false, mesage = SupplierDataAccess.Message }, JsonRequestBehavior.AllowGet));
             }
         }
         else
         {
             return(Json(new { succes = false, message = "Isi data dulu dengan benar!" }, JsonRequestBehavior.AllowGet));
         }
     }
     catch (Exception ex)
     {
         return(Json(new { success = false, message = ex.Message }, JsonRequestBehavior.AllowGet));
     }
 }
 public ActionResult CreateEdit(SupplierViewModel model)
 {
     try
     {
         if (ModelState.IsValid)
         {
             if (SupplierDataAccess.Update(model))
             {
                 return(Json(new { success = true, message = "Success" }, JsonRequestBehavior.AllowGet));
             }
             else
             {
                 return(Json(new { success = false, message = SupplierDataAccess.Message }, JsonRequestBehavior.AllowGet));
             }
         }
         else
         {
             return(Json(new { success = false, message = "Please fulfill required fields!" }, JsonRequestBehavior.AllowGet));
         }
     }
     catch (Exception ex)
     {
         return(Json(new { success = false, message = ex.Message }, JsonRequestBehavior.AllowGet));
     }
 }