private void SeedClubs()
        {
            var clubsData = File.ReadAllText("Persistence/Data/Clubs.json");
            var clubs     = JsonConvert.DeserializeObject <JArray>(clubsData);

            foreach (var clubToken in clubs)
            {
                var homeField = clubToken["homeField"].ToString();

                var stadiumTask = _stadiumRepository.SingleOrDefaultAsync(s => s.Name == homeField);
                stadiumTask.Wait();

                var stadium = stadiumTask.Result;
                if (stadium == null)
                {
                    continue;
                }

                var club = JsonConvert.DeserializeObject <Club>(clubToken.ToString(), _jsonSerializerSettings);
                club.Stadium = stadium;

                _clubRepository.Add(club);
            }

            _unitOfWork.CompleteAsync().Wait();
        }
        public IHttpActionResult Post([FromBody] Club club)
        {
            var result = new Club();

            if (ModelState.IsValid)
            {
                if (club.Country == null)
                {
                    return(Content(HttpStatusCode.BadRequest, "Club is empty"));
                }

                if (club.Country.Id == 0 || clubRepository.Get(club.Country.Id) == null)
                {
                    return(Content(HttpStatusCode.NotFound, "Club not found"));
                }

                result = clubRepository.Add(club);
            }

            return(Json(result));
        }
 public async Task CreateAsync(Club club)
 {
     _clubRepository.Add(club);
     await _unitOfWork.CompleteAsync();
 }
        public RedirectToActionResult Addclub(Club club)
        {
            Club newclub = club_Repository.Add(club);

            return(RedirectToAction("Clubdetails", new { id = newclub.Id }));
        }