コード例 #1
0
 public ActionResult Update([DataSourceRequest] DataSourceRequest request,
                            [Bind(Prefix = "models")] List <Property_Detail> list)
 {
     if (asset.Update)
     {
         if (list != null)
         {
             var result = new Property_Detail_DAO().UpSert(list, currentUser.UserName, "Updated");
             if (result == "true")
             {
                 return(Json(new { success = true, message = "Thành công" }));
             }
             else
             {
                 return(Json(new { success = false, message = result }));
             }
         }
         ModelState.AddModelError("", "Model not valid");
         return(Json(new { success = false, message = "" }));
     }
     else
     {
         ModelState.AddModelError("", "You don't have permission to create record");
         return(Json(new { success = false, message = "" }));
     }
 }
コード例 #2
0
 public ActionResult Delete(string data)
 {
     if (asset.Delete)
     {
         try
         {
             string[] separators = { "@@" };
             var      listRowID  = data.Split(separators, StringSplitOptions.RemoveEmptyEntries);
             var      result     = new Property_Detail_DAO().Delete(listRowID);
             if (result == "true")
             {
                 return(Json(new { success = true, message = "Thành công" }));
             }
             else
             {
                 return(Json(new { success = false, message = result }));
             }
         }
         catch (Exception ex)
         {
             return(Json(new { success = false, alert = ex.Message }));
         }
     }
     else
     {
         return(Json(new { success = false, alert = "You don't have permission to create record" }));
     }
 }
コード例 #3
0
 public ActionResult Read([DataSourceRequest] DataSourceRequest request)
 {
     if (asset.View)
     {
         var data = new Property_Detail_DAO().ReadAll();
         return(Json(data.ToDataSourceResult(request)));
     }
     else
     {
         return(RedirectToAction("NoAccessRights", "Error"));
     }
 }