public JsonResult DeleteUser(int?id) { if (Session["LOGGEDIN"] != null) { try { if (id > 0) { User_Property branchProperty = new User_Property(); branchProperty.idx = int.Parse(id.ToString()); objUser = new User_BLL(id); User_BLL branhcBll = new User_BLL(branchProperty); var flag1 = branhcBll.GetById(); //if (flag1.Rows.Count > 0) //{ if (true) { bool flag = objUser.Delete(id); return(Json(new { data = "Deleted", success = flag, statuscode = 200 }, JsonRequestBehavior.AllowGet)); } //else //{ // return Json(new { data = "Mian Branch Cannot be Delete ", success = false, statuscode = 400, count = 0 }, JsonRequestBehavior.AllowGet); //} //} // return Json(new { data = "Process Completed ", success = true, statuscode = 200 }, JsonRequestBehavior.AllowGet); } else { return(Json(new { data = "Error Occur", success = false, statuscode = 400, count = 0 }, JsonRequestBehavior.AllowGet)); } } catch (Exception ex) { return(Json(new { data = ex.Message, success = false, statuscode = 400, count = 0 }, JsonRequestBehavior.AllowGet)); } } else { return(Json(new { data = "Session Expired", success = false, statuscode = 400, count = 0 }, JsonRequestBehavior.AllowGet)); } }