コード例 #1
0
        public async Task <IActionResult> PutAttempt(long id, Attempt attempt)
        {
            if (id != attempt.Id)
            {
                return(BadRequest());
            }

            _context.Entry(attempt).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!AttemptExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
コード例 #2
0
        public async Task <IActionResult> PutFunctionsRun(long id, FunctionsRun functionsRun)
        {
            if (id != functionsRun.Id)
            {
                return(BadRequest());
            }

            _context.Entry(functionsRun).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!FunctionsRunExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
コード例 #3
0
        public async Task <ActionResult <Player> > GetPlayer(string username)
        {
            var players = await _context.Players.Where(p => p.UserName == username).ToListAsync();

            if (players.Count == 0)
            {
                return(NotFound());
            }

            var player = players[0];

            player.LoginLast             = DateTime.Now;
            _context.Entry(player).State = EntityState.Modified;
            await _context.SaveChangesAsync();

            return(player);
        }