示例#1
0
        public async Task <IActionResult> AddMatch([FromBody] Match model)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest());
            }

            try
            {
                await _context.AddAsync(model);

                await _context.SaveChangesAsync();
            }
            catch
            {
                return(BadRequest());
            }

            return(Ok());
        }
示例#2
0
 public async Task AddAsync(Hero hero)
 {
     await _context.AddAsync(hero);
 }