Пример #1
0
        public async Task <IActionResult> PutTdieselEngine(long id, TdieselEngine tdieselEngine)
        {
            if (id != tdieselEngine.TdieselEngineId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Пример #2
0
        public async Task <ActionResult <TdieselEngine> > PostTdieselEngine(TdieselEngine tdieselEngine)
        {
            _context.TdieselEngine.Add(tdieselEngine);
            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateException)
            {
                if (TdieselEngineExists(tdieselEngine.TdieselEngineId))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtAction("GetTdieselEngine", new { id = tdieselEngine.TdieselEngineId }, tdieselEngine));
        }