private int SaveStatus(ServiceHealthDto status) { var service = _serviceHealthRepository .All() .FirstOrDefault(f => f.ServiceId == status.ServiceId); if (null != service) { service.LastPing = DateTime.UtcNow; service.LastStatus = status.LastStatus; _serviceHealthRepository.Update(service); } else { service = new ServiceHealthDbModel { ServiceId = status.ServiceId, ServiceName = status.ServiceName, Description = status.Description, Location = status.Location, LastPing = DateTime.UtcNow, LastStatus = status.LastStatus }; _serviceHealthRepository.Create(service); } return(1); }
private int SaveHistory(ServiceHealthDto status) { var service = new ServiceHealthDbModel { ServiceId = status.ServiceId, ServiceName = status.ServiceName, Description = status.Description, Location = status.Location, LastPing = DateTime.UtcNow, LastStatus = status.LastStatus }; var rowsAffected = _serviceHealthHistoryRepository.Create(service); return(rowsAffected); }