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

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

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

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

            return(NoContent());
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Postdiscount_plans([FromBody] discount_plans discount_plans)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

            return(CreatedAtAction("Getdiscount_plans", new { id = discount_plans.id }, discount_plans));
        }