예제 #1
0
        public ActionResult ManageRoles_Destroy([DataSourceRequest] DataSourceRequest request, PersonRolesMapping _objPersonRoles)
        {
            if (ModelState.IsValid)
            {
                _objPersonRoles.UpdatedBy   = CurrentUser.NameIdentifierInt64;
                _objPersonRoles.UpdatedDate = DateTime.Now;
                //if (_objPersonRoles.RoleID == 2)
                //{

                //}
                var    result = _PersonBAL.TMS_PersonRolesMapping_DeleteBAL(_objPersonRoles);
                string ip     = System.Web.HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
                if (string.IsNullOrEmpty(ip))
                {
                    ip = System.Web.HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"];
                }
                _objConfigurationBAL.Audit_CreateBAL(ip, DateTime.Now, CurrentUser.CompanyID, CurrentUser.NameIdentifierInt64, EventType.Delete, System.Web.HttpContext.Current.Request.Browser.Browser);

                if (result == -1)
                {
                    ModelState.AddModelError(lr.ErrorServerError, lr.ResourceUpdateValidationError);
                }
            }
            var resultData = new[] { _objPersonRoles };

            return(Json(resultData.AsQueryable().ToDataSourceResult(request, ModelState)));
        }