public async System.Threading.Tasks.Task <ActionResult> Index(SettingListDto stting)
        {
            try
            {
                stting.gamesettingList.Where(x => x.sn == 1).FirstOrDefault().outlay = (100 - stting.gamesettingList.Where(x => x.sn == 1).FirstOrDefault().outlay);
                stting = await new DgonHonusRepository().GetSetting(stting);



                return(View(stting));
            }
            catch
            {
                return(View(stting));
            }
        }
        public async System.Threading.Tasks.Task <ActionResult> _topicCreate(SettingListDto setting, HttpPostedFileBase image, HttpPostedFileBase hoverimage)
        {
            if (setting != null && ModelState.IsValid)
            {
                foreach (var s in setting.topicsettingList)
                {
                    if (string.IsNullOrEmpty(s.image) && image != null)
                    {
                        string filename = "";
                        filename = DateTime.Now.ToString("yyyyMMddTHHmmssfff");
                        Google.Apis.Auth.OAuth2.GoogleCredential credential = await Google.Apis.Auth.OAuth2.GoogleCredential.GetApplicationDefaultAsync();

                        _imageUploader = new ImageUploader(System.Web.Configuration.WebConfigurationManager.AppSettings["GoogleCloud:BucketName"]);
                        var imageUrl = await _imageUploader.UploadImage(image, filename, "Topicsimg");

                        s.image = imageUrl;
                    }

                    if (string.IsNullOrEmpty(s.hoverImage) && hoverimage != null)
                    {
                        string filename = "";
                        filename = DateTime.Now.ToString("yyyyMMddTHHmmssfff");
                        Google.Apis.Auth.OAuth2.GoogleCredential credential = await Google.Apis.Auth.OAuth2.GoogleCredential.GetApplicationDefaultAsync();

                        _imageUploader = new ImageUploader(System.Web.Configuration.WebConfigurationManager.AppSettings["GoogleCloud:BucketName"]);
                        var imageUrl = await _imageUploader.UploadImage(hoverimage, filename, "Topicsimg");

                        s.hoverImage = imageUrl;
                    }
                }
                ;
                await new DgonHonusRepository().topicSettingCreate(setting);
                //this.teamsRepository.Create(teams);
                return(View(setting));
                //return RedirectToAction("nabobindex", "Setting");
            }
            else
            {
                return(View(setting));
            }
        }
示例#3
0
        public async System.Threading.Tasks.Task <SettingListDto> topicGameListAsync()
        {
            SettingListDto      gameList = null;
            HttpResponseMessage response = await client.GetAsync("/api/gamestopic");

            if (response.IsSuccessStatusCode)
            {
                gameList = await response.Content.ReadAsAsync <SettingListDto>();
            }

            lock (_cache)
            {
                CacheItemPolicy cacheItemPolicy = new CacheItemPolicy()
                {
                    AbsoluteExpiration = DateTime.Now.AddDays(1)
                };
                _cache.Remove("GameList");
                _cache.Add("GameList", gameList, cacheItemPolicy);
            }

            return(gameList);
        }
        public async System.Threading.Tasks.Task <ActionResult> _topicCreate(SettingListDto model, int?index)
        {
            //SettingListDto gameb = await new SttingRepository().GetTopicSettingList();
            model.topicsettingList = new List <topicSettingDto>();
            for (int i = 0; i <= index; i++)
            {
                model.topicsettingList.Add(new topicSettingDto {
                    id = ((int)index + 1), valid = 1, gametype = 1, choicsettingList = new List <choiceSettingDto>()
                });
                for (int j = 0; j < 2; j++)
                {
                    model.topicsettingList[i].choicsettingList.Add(new choiceSettingDto {
                        valid = 1, topiceSetting = (index + 1)
                    });
                }
            }


            ViewBag.Index = index;

            return(View(model));
        }
 public ActionResult _nabobLol(SettingListDto stting)
 {
     return(View(stting));
 }
 public ActionResult _GuessCSGO(SettingListDto stting)
 {
     return(View(stting));
 }