public async Task <IActionResult> PutLink(int id, Link link)
        {
            if (id != link.Id)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Exemple #2
0
        public async Task <ActionResult> Adicionar()
        {
            var customer = new Customer();

            customer.FirstName = "João";
            customer.LastName  = "Da Silva";
            _context.Customers.Add(customer);
            await _context.SaveChangesAsync();

            return(Ok(customer));
        }
 public async Task AddAuthHistoryAsync(AuthHistory history)
 {
     _context.AuthenticationHistory.Add(history);
     await _context.SaveChangesAsync();
 }