Пример #1
0
        public async Task <IActionResult> PutMapItemRequestArea([FromRoute] int id, [FromBody] MapItemRequestArea mapItemRequestArea)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

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

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

            return(NoContent());
        }
Пример #2
0
        public async Task <IActionResult> PostMapItemRequestArea([FromBody] MapItemRequestArea mapItemRequestArea)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            _context.MapItemRequestArea.Add(mapItemRequestArea);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetMapItemRequestArea", new { id = mapItemRequestArea.IrAreaId }, mapItemRequestArea));
        }