public async Task <ActionResult <SpiderpigDto> > PutSpiderpigObservation(int id, [FromBody] SpiderpigDto spiderpigObservation)
        {
            var updateSpiderpigObservation = await _context.Spiderpigs
                                             .FirstOrDefaultAsync(sd => sd.Id == id);

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

            updateSpiderpigObservation.BuildingId = spiderpigObservation.BuildingId;
            updateSpiderpigObservation.Glasses    = spiderpigObservation.Glasses;
            updateSpiderpigObservation.Friendly   = spiderpigObservation.Friendly;

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

            await _context.SaveChangesAsync();

            return(NoContent());
        }
예제 #2
0
        public async Task <ActionResult <IncidentDto> > PutShitHappen(int id, [FromBody] IncidentDto incident)
        {
            var updateShitHappen = await _context.Incidents
                                   .FirstOrDefaultAsync(sd => sd.Id == id);

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

            updateShitHappen.Temperature = incident.Temperature;
            updateShitHappen.Responsible = incident.Responsible;
            updateShitHappen.Location    = incident.Location;
            updateShitHappen.Status      = incident.Status;
            updateShitHappen.Date        = incident.Date;

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

            await _context.SaveChangesAsync();

            return(NoContent());
        }
예제 #3
0
        public async Task <ActionResult <PersonDto> > PutSecretLair(int id, [FromBody] PersonDto secretNSAFile)
        {
            var updateNSAFile = await _context.Persons
                                .Include(l => l.Location)
                                .FirstOrDefaultAsync(sd => sd.Id == id);

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

            updateNSAFile.FirstName = secretNSAFile.FirstName;
            updateNSAFile.LastName  = secretNSAFile.LastName;
            updateNSAFile.Email     = secretNSAFile.Email;
            //updateNSAFile.Location. = secretLair.Position.Lat;
            //updateNSAFile.Position.Lng = secretLair.Position.Lng;

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

            await _context.SaveChangesAsync();

            return(NoContent());
        }
예제 #4
0
        public async Task <ActionResult <BuildingDto> > PutSecretLair(int id, [FromBody] BuildingDto secretLair)
        {
            var updateSecretLair = await _context.Buildings
                                   .Include(p => p.Position)
                                   .FirstOrDefaultAsync(sd => sd.Id == id);

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

            updateSecretLair.Title        = secretLair.Title;
            updateSecretLair.Icon         = secretLair.Icon;
            updateSecretLair.Feed         = secretLair.Feed;
            updateSecretLair.Position.Lat = secretLair.Position.Lat;
            updateSecretLair.Position.Lng = secretLair.Position.Lng;

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

            await _context.SaveChangesAsync();

            return(NoContent());
        }