public JsonResult AddUpdate(User_Property objuser) { if (Session["LOGGEDIN"] != null) { try { if (objuser.idx > 0) { objuser.lastModifiedByUserIdx = 1; objuser.lastModificationDate = DateTime.Now.ToString("dd/MM/yyyy"); objUser = new User_BLL(objuser); bool flag = objUser.Update(); return(Json(new { data = "Updated", success = flag, statuscode = 200 }, JsonRequestBehavior.AllowGet)); } else { objuser.companyIdx = 1; objuser.createdByUserIdx = 1; objUser = new User_BLL(objuser); //if (objUser.isMainBranch == 1) //{ // var check = objUser.MainBranch(); // if (check.Rows.Count > 0) // { // return Json(new { data = "Main Branch Already Exist", success = false, statuscode = 500 }, JsonRequestBehavior.AllowGet); // } //} bool flag = objUser.Insert(); return(Json(new { data = "Inserted", success = flag, statuscode = 200 }, 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)); } }