public async Task <ActionResult <StoredSerials> > PostStoredSerials(StoredSerials storedSerials)
        {
            _context.StoredSerials.Add(storedSerials);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetStoredSerials", new { id = storedSerials.id }, storedSerials));
        }
        public async Task <IActionResult> PutStoredSerials(int id, StoredSerials storedSerials)
        {
            if (id != storedSerials.id)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Exemplo n.º 3
0
        public async Task <StoredSerials> Update(StoredSerials storedSerial)
        {
            _context.Update(storedSerial);
            await _context.SaveChangesAsync();

            return(storedSerial);
        }
Exemplo n.º 4
0
        public async Task <StoredSerials> Add(StoredSerials storedSerial)
        {
            await _context.StoredSerials.AddAsync(storedSerial);

            await _context.SaveChangesAsync();

            return(storedSerial);
        }
        public async Task <IActionResult> PostStoredSerials([FromBody] StoredSerials storedSerials)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            _context.StoredSerials.Add(storedSerials);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetStoredSerials", new { id = storedSerials.StoredSerialsId }, storedSerials));
        }