コード例 #1
0
        public async Task <IActionResult> PostPoolStatusEmailHistory([FromBody] PoolStatusEmailHistory poolStatusEmailHistory)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            _context.PoolStatusEmailHistory.Add(poolStatusEmailHistory);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetPoolStatusEmailHistory", new { id = poolStatusEmailHistory.idPoolStatusEmailHistory }, poolStatusEmailHistory));
        }
コード例 #2
0
        public async Task <IActionResult> PutPoolStatusEmailHistory([FromRoute] long id, [FromBody] PoolStatusEmailHistory poolStatusEmailHistory)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != poolStatusEmailHistory.idPoolStatusEmailHistory)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }