Esempio n. 1
0
        public async Task <IActionResult> PostPBonusTransactionStatus([FromBody] PBonusTransactionStatus pBonusTransactionStatus)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            _context.BonusTransactionStatus.Add(pBonusTransactionStatus);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetPBonusTransactionStatus", new { id = pBonusTransactionStatus.Id }, pBonusTransactionStatus));
        }
Esempio n. 2
0
        public async Task <IActionResult> PutPBonusTransactionStatus([FromRoute] int id, [FromBody] PBonusTransactionStatus pBonusTransactionStatus)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

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

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

            return(NoContent());
        }