예제 #1
0
        public async Task <ActionResult> Edit(TournamentsView view)
        {
            if (ModelState.IsValid)
            {
                var picture = view.Logo;
                var folder  = "~/Content/Logos";

                if (view.LogoFile != null)
                {
                    picture = FileHelper.UploadPhoto(view.LogoFile, folder);
                    picture = $"{folder}/{picture}";
                }

                var tournament = ToTournament(view);

                tournament.Logo = picture;

                db.Entry(tournament).State = EntityState.Modified;

                try
                {
                    await db.SaveChangesAsync();
                }
                catch (Exception)
                {
                }

                return(RedirectToAction("Index"));
            }
            return(View(view));
        }
예제 #2
0
        // GET: Trading
        public ActionResult Index()
        {
            var model = new TournamentsView
            {
                List = this.tradingContentService.GetTournaments(new SearchTagsView())
            };

            return(View(model));
        }
예제 #3
0
 private Tournament ToTournament(TournamentsView view)
 {
     return(new Tournament()
     {
         Name = view.Name,
         Logo = view.Logo,
         IsActive = view.IsActive,
         Order = view.Order,
         TournamentId = view.TournamentId,
     });
 }