示例#1
0
        public async Task <IActionResult> PutConfOutcomeState([FromRoute] int id, [FromBody] ConfOutcomeState confOutcomeState)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != confOutcomeState.Recid)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
示例#2
0
        public async Task <IActionResult> PostConfOutcomeState([FromBody] ConfOutcomeState confOutcomeState)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            _context.ConfOutcomeState.Add(confOutcomeState);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetConfOutcomeState", new { id = confOutcomeState.Recid }, confOutcomeState));
        }