コード例 #1
0
ファイル: VersionController.cs プロジェクト: suposk/CSRO
        public async Task <ActionResult <AppVersionDto> > GetVersion(string version)
        {
            _logger.LogInformation(ApiLogEvents.GetItem, $"{nameof(GetVersion)} {version} Started");

            AppVersionDto result = null;
            var           res    = await _versionRepository.GetVersion(version);

            result = _mapper.Map <AppVersionDto>(res);
            return(result);
        }
コード例 #2
0
        public async Task <ResponseViewModel <AppVersionDto> > VersionDtorenewal([FromBody] RequestViewModel obj)
        {
            obj = JsonHelper.DeserializeJsonToObject <RequestViewModel>(Content(User.Identity.Name).Content);
            ResponseViewModel <AppVersionDto> response = null;
            var           code        = SysCode.Ok;
            AppVersionDto appVersion  = new AppVersionDto();
            int           platform    = obj.Client.Platform == "Android" ? 1 : 0;
            long          versionCode = long.Parse(obj.Client.VersionCode);

            appVersion = await _routine.VersionRenewalAsync(versionCode, platform);

            if (appVersion != null)
            {
                appVersion.Download_url = $"{appVersion.Download_url}{obj.Client.Channel}-release.apk";
            }
            response = new ResponseViewModel <AppVersionDto>(code, appVersion ?? null, obj.Encrypt, _sys, obj.Secret);
            return(response);
        }
コード例 #3
0
        public async Task <IActionResult> VersionEdit(long?id, long?AppId)
        {
            if (id.HasValue)
            {
                //编辑
                var model = await _versionService.GetByIdAsync(id.Value);

                if (model == null)
                {
                    throw new VinoDataNotFoundException("无法取得数据!");
                }
                //取得app信息
                var appdto = await _service.GetByIdAsync(model.AppId);

                if (appdto == null)
                {
                    throw new VinoDataNotFoundException("无法取得数据!");
                }
                model.App        = appdto;
                ViewData["Mode"] = "Edit";
                return(View(model));
            }
            else
            {
                if (!AppId.HasValue)
                {
                    throw new VinoArgNullException("缺少参数AppId!");
                }
                //取得app信息
                var appdto = await _service.GetByIdAsync(AppId.Value);

                if (appdto == null)
                {
                    throw new VinoDataNotFoundException("无法取得数据!");
                }
                //新增
                AppVersionDto dto = new AppVersionDto();
                dto.AppId        = appdto.Id;
                dto.App          = appdto;
                ViewData["Mode"] = "Add";
                return(View(dto));
            }
        }
コード例 #4
0
        public async Task OnGetAsync(long?id, long?AppId)
        {
            if (id.HasValue)
            {
                Dto = await _service.GetByIdAsync(id.Value);

                if (Dto == null)
                {
                    throw new VinoDataNotFoundException();
                }

                //取得app信息
                var appdto = await _appService.GetByIdAsync(Dto.AppId);

                if (appdto == null)
                {
                    throw new VinoDataNotFoundException("无法取得应用数据!");
                }
                Dto.App = appdto;

                ViewData["Mode"] = "Edit";
            }
            else
            {
                if (!AppId.HasValue)
                {
                    throw new VinoArgNullException("缺少参数AppId!");
                }
                //取得app信息
                var appdto = await _appService.GetByIdAsync(AppId.Value);

                if (appdto == null)
                {
                    throw new VinoDataNotFoundException("无法取得数据!");
                }
                Dto       = new AppVersionDto();
                Dto.AppId = appdto.Id;
                Dto.App   = appdto;

                ViewData["Mode"] = "Add";
            }
        }
コード例 #5
0
        public async Task <IActionResult> VersionSave(AppVersionDto model)
        {
            await _versionService.SaveAsync(model);

            return(JsonData(true));
        }