public async Task <IActionResult> Edit(Tournamentdto tournament)
        {
            if (ModelState.IsValid)
            {
                var directory = Path.Combine(_hosting.WebRootPath, "Home", "images", "Tournament");
                if (!Directory.Exists(directory))
                {
                    Directory.CreateDirectory(directory);
                }
                if (tournament.TournamentImage != null)
                {
                    tournament.FileName = tournament.TournamentImage.FileName;
                    using (var stream = new FileStream(Path.Combine(directory, tournament.FileName), FileMode.Create))
                    {
                        await tournament.TournamentImage.CopyToAsync(stream);
                    }
                }
                var users = await _userManager.GetUserAsync(HttpContext.User);

                var tournamentModal = _mapper.Map <Tournament>(tournament);
                tournamentModal.UserId = users.Id;
                _context.Tournaments.Update(tournamentModal);
                await _context.SaveChangesAsync();

                return(Json(ResponseHelper.UpdateSuccess()));
            }
            return(Json(ResponseHelper.UpdateUnSuccess()));
        }
        public async Task <IActionResult> Create(Tournamentdto tournament)
        {
            if (ModelState.IsValid)
            {
                var users = await _userManager.GetUserAsync(HttpContext.User);

                var tournamentModel = _mapper.Map <Tournament>(tournament);
                tournamentModel.UserId = users.Id;
                _context.Tournaments.Add(tournamentModel);
                await _context.SaveChangesAsync();

                return(Json(ResponseHelper.Success()));
            }
            return(Json(ResponseHelper.UnSuccess()));
        }