public JObject LoginCredentials(JObject jsonObject) { try { apiCall = apiCalls.PostRequest(jsonObject, apiConfig.Url + apiConfig.SignIn); } catch (Exception e) { var stackTrace = new StackTrace(e, true); var frame = stackTrace.GetFrame(0); var line = frame.GetFileLineNumber(); var file = frame.GetFileName(); _logger.LogError($"{DateTime.Now} - [{file} : {line}] Cannot make post-request to API"); } return(apiCall); }
public Boolean SendNotification(UploadableNotification notification) { var notificationJsonObject = (JObject)JToken.FromObject(notification); logger.LogInformation($"{DateTime.Now} - Uploading notification to API."); var result = apiCalls.PostRequest(notificationJsonObject, apiConfig.Url + apiConfig.SendNotification); if (!result.HasValues) { logger.LogWarning($"{DateTime.Now} - Uploading notification failed"); return(false); } return(true); }
public Boolean AddReservation(UploadableReservation reservation) { var reservationJsonObject = (JObject)JToken.FromObject(reservation); logger.LogInformation($"{DateTime.Now} - Uploading reservation to API."); var result = apiCalls.PostRequest(reservationJsonObject, apiConfig.Url + apiConfig.UploadHour); if (!result.HasValues) { logger.LogError($"{DateTime.Now} - Uploading reservation failed"); return(false); } return(true); }