Example #1
0
        public async Task <ActionResult <StateBuy> > PostStateBuy(StateBuy stateBuy)
        {
            _context.StateBuy.Add(stateBuy);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetStateBuy", new { id = stateBuy.StateBuyId }, stateBuy));
        }
Example #2
0
        public async Task <IActionResult> PutStateBuy(int id, StateBuy stateBuy)
        {
            if (id != stateBuy.StateBuyId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }