Пример #1
0
        public async Task <IActionResult> PutAnulacionesVentas([FromRoute] int id, [FromBody] AnulacionesVentas anulacionesVentas)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

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

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

            return(NoContent());
        }
Пример #2
0
        public async Task <IActionResult> PostAnulacionesVentas([FromBody] AnulacionesVentas anulacionesVentas)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            anulacionesVentas.Fecha = DateTime.Now;
            _context.AnulacionesVentas.Add(anulacionesVentas);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetAnulacionesVentas", new { id = anulacionesVentas.ID }, anulacionesVentas));
        }