Ejemplo n.º 1
0
        public async Task <ActionResult <CasaBox> > PostCasaBox(CasaBox casaBox)
        {
            _context.CasaBoxes.Add(casaBox);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetCasaBox", new { id = casaBox.BoxNummer }, casaBox));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> PutCasaBox(int id, CasaBox casaBox)
        {
            if (id != casaBox.BoxNummer)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }