示例#1
0
        public async Task <IActionResult> Putfloors([FromRoute] int id, [FromBody] floors floors)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

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

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

            return(NoContent());
        }
示例#2
0
        public async Task <IActionResult> Postfloors([FromBody] floors floors)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            _context.floors.Add(floors);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("Getfloors", new { id = floors.id }, floors));
        }