Esempio n. 1
0
        public async Task <Club> AddAsync(CreateClubViewModel c)
        {
            var newClub = new Club
            {
                Name             = c.Name,
                Webpage          = c.Webpage,
                Email            = c.Email,
                Phone            = c.Phone,
                NameAbbreviation = c.NameAbbreviation
            };
            await _repo.InsertAsync(newClub);

            return(newClub);
        }
Esempio n. 2
0
        public async Task <IActionResult> Create(CreateClubViewModel model)
        {
            if (ModelState.IsValid && model.Name != null)
            {
                var exists = await _clubService.ClubExistsAsync(model.Name);

                if (!exists)
                {
                    await _clubService.AddAsync(model);

                    return(RedirectToAction("Clubs", "Admin"));
                }
            }
            return(View(model));
        }