Ejemplo n.º 1
0
        public async Task <IActionResult> PutEauxiliarySupply(short id, EauxiliarySupply eauxiliarySupply)
        {
            if (id != eauxiliarySupply.EauxiliarySupplyId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Ejemplo n.º 2
0
        public async Task <ActionResult <EauxiliarySupply> > PostEauxiliarySupply(EauxiliarySupply eauxiliarySupply)
        {
            _context.EauxiliarySupply.Add(eauxiliarySupply);
            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateException)
            {
                if (EauxiliarySupplyExists(eauxiliarySupply.EauxiliarySupplyId))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtAction("GetEauxiliarySupply", new { id = eauxiliarySupply.EauxiliarySupplyId }, eauxiliarySupply));
        }