Пример #1
0
        public async Task <IActionResult> PutDbCarDetail(int id, DbCarDetail dbCarDetail)
        {
            if (id != dbCarDetail.ID)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Пример #2
0
        public async Task <IActionResult> DeleteAuto(int id)
        {
            var modell = await _context.Modellek.FindAsync(id);

            if (modell == null)
            {
                return(NotFound());
            }

            var reszletek = await _context.Reszletek.FindAsync(modell.ReszletekId);

            if (reszletek == null)
            {
                return(NotFound());
            }

            _context.Modellek.Remove(modell);
            _context.Reszletek.Remove(reszletek);
            await _context.SaveChangesAsync();

            return(NoContent());
        }