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)); }
// GET: Trading public ActionResult Index() { var model = new TournamentsView { List = this.tradingContentService.GetTournaments(new SearchTagsView()) }; return(View(model)); }
private Tournament ToTournament(TournamentsView view) { return(new Tournament() { Name = view.Name, Logo = view.Logo, IsActive = view.IsActive, Order = view.Order, TournamentId = view.TournamentId, }); }