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

            _context.BonusTransactionStatusData.Add(pBonusTransactionStatusData);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetPBonusTransactionStatusData", new { id = pBonusTransactionStatusData.Id }, pBonusTransactionStatusData));
        }
コード例 #2
0
        public async Task <IActionResult> PutPBonusTransactionStatusData([FromRoute] int id, [FromBody] PBonusTransactionStatusData pBonusTransactionStatusData)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

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

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

            return(NoContent());
        }