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

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

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

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

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

            _context.CooperTestDetails.Add(cooperTestDetail);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetCooperTestDetail", new { id = cooperTestDetail.Id }, cooperTestDetail));
        }