예제 #1
0
        public async Task <IActionResult> PutEdoors(short id, Edoors edoors)
        {
            if (id != edoors.EdoorsId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
예제 #2
0
        public async Task <ActionResult <Edoors> > PostEdoors(Edoors edoors)
        {
            _context.Edoors.Add(edoors);
            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateException)
            {
                if (EdoorsExists(edoors.EdoorsId))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtAction("GetEdoors", new { id = edoors.EdoorsId }, edoors));
        }