예제 #1
0
        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());
        }
예제 #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));
        }
예제 #3
0
 public async Task AddAuthHistoryAsync(AuthHistory history)
 {
     _context.AuthenticationHistory.Add(history);
     await _context.SaveChangesAsync();
 }