Example #1
0
        public JsonResult BlockUser(string userid, string agentid)
        {
            var  data  = new CommonDbResponse();
            bool valid = true;

            if (!String.IsNullOrEmpty(userid))
            {
                userid = userid.DecryptParameter();
                if (string.IsNullOrEmpty(userid))
                {
                    data = new CommonDbResponse {
                        ErrorCode = 1, Message = "Invalid User."
                    };
                    valid = false;
                }
            }

            if (!String.IsNullOrEmpty(agentid))
            {
                agentid = agentid.DecryptParameter();
                if (string.IsNullOrEmpty(agentid))
                {
                    data = new CommonDbResponse {
                        ErrorCode = 1, Message = "Invalid User."
                    };
                    valid = false;
                }
            }
            if (valid)
            {
                data = _distributor.block_unblockuser(userid, "N", agentid);
                if (data.ErrorCode == 0)
                {
                    data.Message = "Successfully Blocked User";
                }
            }

            data.SetMessageInTempData(this);
            return(Json(data));
        }