Ejemplo n.º 1
0
        public async Task <IActionResult> PutTdoors(long id, Tdoors tdoors)
        {
            if (id != tdoors.TdoorsId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Ejemplo n.º 2
0
        public async Task <ActionResult <Tdoors> > PostTdoors(Tdoors tdoors)
        {
            _context.Tdoors.Add(tdoors);
            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateException)
            {
                if (TdoorsExists(tdoors.TdoorsId))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtAction("GetTdoors", new { id = tdoors.TdoorsId }, tdoors));
        }