Esempio n. 1
0
        public async Task <IActionResult> PutEPICargoModel(int id, EPICargoModel ePICargoModel)
        {
            if (id != ePICargoModel.IdCargo)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Esempio n. 2
0
        public async Task <ActionResult <EPICargoModel> > PostEPICargoModel(EPICargoModel ePICargoModel)
        {
            _context.EPICargoModels.Add(ePICargoModel);
            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateException)
            {
                if (EPICargoModelExists(ePICargoModel.IdCargo))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtAction("GetEPICargoModel", new { id = ePICargoModel.IdCargo }, ePICargoModel));
        }