Ejemplo n.º 1
0
        public async Task <IActionResult> PutBFormulaDetail([FromRoute] int id, [FromBody] BFormulaDetail bFormulaDetail)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

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

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

            return(NoContent());
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> PostBFormulaDetail([FromBody] BFormulaDetail bFormulaDetail)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            _context.BFormulaDetail.Add(bFormulaDetail);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetBFormulaDetail", new { id = bFormulaDetail.Id }, bFormulaDetail));
        }