コード例 #1
0
        public async Task <IActionResult> MoveLeft(int id)
        {
            var card = _context.Card.Find(id);

            Console.WriteLine(card.Id);

            if (card.ColumnId != 1)
            {
                card.ColumnId = (card.ColumnId - 1);
                _context.Entry(card).State = EntityState.Modified;
            }
            else
            {
                return(BadRequest());
            }

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!CardExists(card.Id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(Ok());
        }
コード例 #2
0
        public async Task <IActionResult> PutCard(int id, Card card)
        {
            if (id != card.Id)
            {
                return(BadRequest());
            }

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

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

            return(Ok(card));
        }
コード例 #3
0
        public async Task <IActionResult> PutUser(int id, User user)
        {
            if (id != user.Id)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
コード例 #4
0
        public Usuario RegistrarAcesso(Usuario UsuarioAcesso)
        {
            UsuarioAcesso.UsuarioDtUltimoAcesso = DateTime.Now;
            Contexto.Usuario.Attach(UsuarioAcesso);
            Contexto.Entry(UsuarioAcesso).State = EntityState.Modified;
            Contexto.SaveChanges();

            return(UsuarioAcesso);
        }