Пример #1
0
        public async Task <IActionResult> PutEengine(short id, Eengine eengine)
        {
            if (id != eengine.EengineId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Пример #2
0
        public async Task <ActionResult <Eengine> > PostEengine(Eengine eengine)
        {
            _context.Eengine.Add(eengine);
            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateException)
            {
                if (EengineExists(eengine.EengineId))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtAction("GetEengine", new { id = eengine.EengineId }, eengine));
        }