public async Task <IActionResult> Edit(int id, [Bind("Id,GoalsLost,GoalsWon,LossesDuringAddedTime,LossesDuringMainTime,Points,Title,WinsDuringAddedTime,WinsDuringMainTime")] DomainTeam domainTeam)
        {
            if (id != domainTeam.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(domainTeam);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!DomainTeamExists(domainTeam.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Index"));
            }
            return(View(domainTeam));
        }
        public async Task <IActionResult> Create([Bind("Id,GoalsLost,GoalsWon,LossesDuringAddedTime,LossesDuringMainTime,Points,Title,WinsDuringAddedTime,WinsDuringMainTime")] DomainTeam domainTeam)
        {
            if (ModelState.IsValid)
            {
                _context.Add(domainTeam);
                await _context.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(domainTeam));
        }
Esempio n. 3
0
 public void AddDomainTeamIfNotExits(Team jsonTeam)
 {
     if (!context.DomainTeam.Any(t => t.Title == jsonTeam.Title))
     {
         var team = new DomainTeam
         {
             Title = jsonTeam.Title
         };
         context.Add(team);
     }
 }