public JsonResult deleteRegister(string ids) { List <ClsUserDisplay> userDisplay = new List <ClsUserDisplay>(); using (tdoEntities db = new tdoEntities()) { userDisplay = db.uspGetUserDisplay(GetID()).ToList <ClsUserDisplay>(); } List <string> deleteableForms = Restriction.GetDeletableForms(userDisplay); if (!deleteableForms.Contains("Register")) { return(Json(new { id = 0, isSuccess = false, msg = "You are not allowed to delete records here" })); } string[] id_s = ids.Trim().Split(','); string message = ""; List <ClsReturnValues> obj = new List <ClsReturnValues>(); foreach (var id in id_s) { int _id = 0; try { _id = int.Parse(id.Trim()); } catch { } if (_id > 0) { obj.Add(Modules.delRegister(_id)); } } bool isSuccess = obj.Count(p => p.IsSuccess == false) > 0 ? false : true; if (obj.Count(p => p.IsSuccess == true) > 1) { message = obj.Count(p => p.IsSuccess == true).ToString() + " records deleted"; } else { message = obj.Count(p => p.IsSuccess == true).ToString() + " record deleted"; } return(Json(new { id = isSuccess ? 1 : 0, isSuccess = isSuccess ? 1 : 0, msg = message })); }