Exemple #1
0
        public async Task <IActionResult> Check(string key)
        {
            var result = new ApiResultModel <bool>();

            _client = new ClientInfomation(HttpContext);
            var keystore = await _cache.GetAsync(CacheModel.ApiKey + _client.GetClientID());

            if (keystore != null)
            {
                if (Encoding.UTF8.GetString(keystore).Equals(key))
                {
                    result.Data = true;
                    return(Ok(result));
                }
                else
                {
                    result.Notfound();
                    result.Data = false;
                    return(NotFound(result));
                }
            }
            else
            {
                result.Notfound("API key not found");
                return(NotFound(result));
            }
        }
Exemple #2
0
        //[ApiAutherize]
        public async Task <ActionResult> Index(Guid id)
        {
            var result = new ApiResultModel <Tags>();
            var data   = await _storage.GetRepository <ITags_Repository>().GetAsync(x => x.id == id);

            if (data != null)
            {
                result.Data = data;
                return(Ok(result));
            }
            else
            {
                result.Notfound();
                return(NotFound(result));
            }
        }
        public async Task <ActionResult> ToEdit(Guid id)
        {
            var result = new ApiResultModel <UsersEditModel>();
            var data   = await _storage.GetRepository <IUsers_Repository>().GetAsync(x => x.id == id);

            if (data != null)
            {
                result.Data = _mapper.Map <UsersEditModel>(data);
                return(Ok(result));
            }
            else
            {
                result.Notfound();
                return(NotFound(result));
            }
        }
Exemple #4
0
        public async Task <ActionResult> Setup(string type)
        {
            if (type == null || !type.Equals("setup"))
            {
                throw new ArgumentException("Type is required, or not match");
            }
            var result = new ApiResultModel <bool>();
            var setup  = await _storage.GetRepository <IPolicy_Repository>().SetupMudules();

            if (setup)
            {
                result.Data = setup;
                return(Ok(result));
            }
            else
            {
                result.Notfound();
                return(NotFound(result));
            }
        }
Exemple #5
0
        public ActionResult Index()
        {
            var result = new ApiResultModel <List <IExtension> >();

            if (_appSettings.AssemblyCandidate)
            {
                string[] starts = new string[] { "ExtCore" };
                result.Data = ExtensionManager.GetInstances <IExtension>().Where(x => !starts.Any(sl => x.Name.StartsWith(sl))).ToList();
            }
            else
            {
                result.Data = ExtensionManager.GetInstances <IExtension>().ToList();
            }

            if (result.Data != null)
            {
                return(Ok(result));
            }
            else
            {
                result.Notfound();
                return(NotFound(result));
            }
        }