Example #1
0
        public async Task <IActionResult> PutEpropulsion(short id, Epropulsion epropulsion)
        {
            if (id != epropulsion.EpropulsionId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Example #2
0
        public async Task <ActionResult <Epropulsion> > PostEpropulsion(Epropulsion epropulsion)
        {
            _context.Epropulsion.Add(epropulsion);
            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateException)
            {
                if (EpropulsionExists(epropulsion.EpropulsionId))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtAction("GetEpropulsion", new { id = epropulsion.EpropulsionId }, epropulsion));
        }