Beispiel #1
0
        public async Task <IActionResult> PostOtherCreditCardInfo([FromBody] OtherCreditCardInfo otherCreditCardInfo)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            _context.OtherCreditCardInfos.Add(otherCreditCardInfo);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetOtherCreditCardInfo", new { id = otherCreditCardInfo.ID }, otherCreditCardInfo));
        }
Beispiel #2
0
        public async Task <IActionResult> PutOtherCreditCardInfo([FromRoute] Guid id, [FromBody] OtherCreditCardInfo otherCreditCardInfo)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != otherCreditCardInfo.ID)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }