Exemplo n.º 1
0
        public async Task <IActionResult> PutBMachineKinds([FromRoute] int id, [FromBody] BMachineKinds bMachineKinds)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

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

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

            return(NoContent());
        }
Exemplo n.º 2
0
        public async Task <IActionResult> PostBMachineKinds([FromBody] BMachineKinds bMachineKinds)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            _context.BMachineKinds.Add(bMachineKinds);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetBMachineKinds", new { id = bMachineKinds.KindId }, bMachineKinds));
        }