Esempio n. 1
0
        public async Task <IActionResult> Putpayment_methods([FromRoute] int id, [FromBody] payment_methods payment_methods)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

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

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

            return(NoContent());
        }
Esempio n. 2
0
        public async Task <IActionResult> Postpayment_methods([FromBody] payment_methods payment_methods)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            _context.payment_methods.Add(payment_methods);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("Getpayment_methods", new { id = payment_methods.id }, payment_methods));
        }