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

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

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

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

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

            _context.BPointType.Add(bPointType);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetBPointType", new { id = bPointType.TypeId }, bPointType));
        }