Exemplo n.º 1
0
        public async Task <IActionResult> PutLogin([FromRoute] int id, [FromBody] Login login)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != login.UserId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Exemplo n.º 2
0
 public void AddGraphicCard(GraphicCard graphicCard)
 {
     _context.GraphicCard.Add(graphicCard);
     _context.SaveChangesAsync();
 }
Exemplo n.º 3
0
 public void AddDiskDrive(DiskDrive diskDrive)
 {
     _context.DiskDrive.Add(diskDrive);
     _context.SaveChangesAsync();
 }
Exemplo n.º 4
0
 public void AddMemory(Memory memory)
 {
     _context.Memory.Add(memory);
     _context.SaveChangesAsync();
 }