Exemple #1
0
        public async Task <IActionResult> PutBWorkTool([FromRoute] int id, [FromBody] BWorkTool bWorkTool)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

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

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

            return(NoContent());
        }
Exemple #2
0
        public async Task <IActionResult> PostBWorkTool([FromBody] BWorkTool bWorkTool)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            _context.BWorkTool.Add(bWorkTool);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetBWorkTool", new { id = bWorkTool.Id }, bWorkTool));
        }