public JsonResult CreateOrganizationPrivilege()
        {
            OrganizationPrivilegeResponse response = new OrganizationPrivilegeResponse();
            OrganizationPrivilegeModel    _model   = new OrganizationPrivilegeModel();

            if (Request.Form["OrgId"] != null)
            {
                _model.OrgID = Convert.ToInt64(Request.Form["OrgId"].ToString());
            }
            if (Request.Form["Privileges"] != null)
            {
                _model.PrivilegeIDs = JsonConvert.DeserializeObject <List <long> >(Request.Form["Privileges"]);
            }
            if (Session["UserLogon"] != null)
            {
                _model.Account = (AccountModel)Session["UserLogon"];
            }

            var request = new OrganizationPrivilegeRequest
            {
                Data = _model
            };

            new OrganizationPrivilegeValidator(_unitOfWork, _context).Validate(request, out response);
            return(Json(new { Status = response.Status, Message = response.Message }, JsonRequestBehavior.AllowGet));
        }
        /// <summary>
        /// Get list of organization privilege data
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public OrganizationPrivilegeResponse GetListData(OrganizationPrivilegeRequest request)
        {
            var qry = _unitOfWork.OrgPrivRepository.Get(x => x.OrgID == request.Data.OrgID && x.RowStatus == 0);
            OrganizationPrivilegeModel _model = new OrganizationPrivilegeModel();

            if (qry.Count > 0)
            {
                _model.OrgID = qry.FirstOrDefault().OrgID;
            }

            foreach (var item in qry)
            {
                _model.PrivilegeIDs.Add(item.PrivilegeID);
            }

            var response = new OrganizationPrivilegeResponse
            {
                Entity = _model
            };

            return(response);
        }
        // GET: MappingMaster
        #region ::Organization Role::
        public ActionResult OrgPrivilegeList()
        {
            OrganizationPrivilegeModel opmodel = new OrganizationPrivilegeModel();

            if (Request.QueryString["orgid"] != null)
            {
                var reqOrg = new OrganizationRequest
                {
                    Data = new OrganizationModel
                    {
                        Id = Convert.ToInt64(Request.QueryString["orgid"].ToString())
                    }
                };

                var respOrg = new OrganizationResponse();
                respOrg = new OrganizationHandler(_unitOfWork).GetDetailOrganizationById(reqOrg);
                opmodel.OrganizationName = respOrg.Entity.OrgName;
                opmodel.OrgID            = respOrg.Entity.Id;

                var _request = new OrganizationPrivilegeRequest
                {
                    Data = new OrganizationPrivilegeModel
                    {
                        OrgID = Convert.ToInt64(Request.QueryString["orgid"].ToString())
                    }
                };
                //get Privilege Ids for organization
                var selPrivileges = new OrganizationPrivilegeHandler(_unitOfWork, _context).GetListData(_request);
                if (selPrivileges.Entity.PrivilegeIDs != null && selPrivileges.Entity.PrivilegeIDs.Count > 0)
                {
                    opmodel.PrivilegeIDs = selPrivileges.Entity.PrivilegeIDs;
                }
            }

            return(View(opmodel));
        }