Esempio n. 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());
        }
Esempio n. 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);
        }
Esempio n. 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);
        }
Esempio n. 4
0
        public async Task <IActionResult> PutConfig(Configuration config)
        {
            _context.Entry(config).State = EntityState.Modified;

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

            return(NoContent());
        }
Esempio n. 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());
 }