コード例 #1
0
        public async Task <IActionResult> PutCar(int id, Car car)
        {
            if (id != car.CarId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
コード例 #2
0
        public async Task <ActionResult <LogEntry> > DeleteLogEntry(int id)
        {
            LogEntry logEntry = await _context.LogEntry.FindAsync(id);

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

            _context.LogEntry.Remove(logEntry);
            await _context.SaveChangesAsync();

            return(logEntry);
        }
コード例 #3
0
        public async Task <ActionResult <Session> > DeleteSession(int id)
        {
            Session session = await _context.Session.FindAsync(id);

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

            _context.Session.Remove(session);
            await _context.SaveChangesAsync();

            return(session);
        }
コード例 #4
0
        public async Task <IActionResult> PutConfig(Configuration config)
        {
            _context.Entry(config).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                throw;
            }

            return(NoContent());
        }
コード例 #5
0
 public async Task <IActionResult> PutPerson(int id, Person person)
 {
     if (id != person.PersonId)
     {
         return(BadRequest());
     }
     _context.Entry(person).State = EntityState.Modified;
     try
     {
         await _context.SaveChangesAsync();
     }
     catch (DbUpdateConcurrencyException)
     {
         if (!PersonModelExists(id))
         {
             return(NotFound());
         }
         else
         {
             throw;
         }
     }
     return(NoContent());
 }