public GenericSimpleResult DisponivelParaRetirada(string token, string guid) { var result = new GenericSimpleResult(); var data = new { guid = guid }; var url = string.Format("{0}{1}", _urlBase, Constants.URL_MANAGER_PEDIDO_PRONTO); var client = new RestClient(url); var request = new RestRequest(Method.POST); request.AddHeader("Authorization", string.Format("bearer {0}", token)); request.AddParameter("application/json", JsonConvert.SerializeObject(data), ParameterType.RequestBody); IRestResponse response = client.Execute(request); if (response.StatusCode == System.Net.HttpStatusCode.OK) { result.Success = true; result.Json = response.Content; } else { result.Message = response.StatusDescription; } return(result); }
public GenericSimpleResult Cancel(string token, string id) { var dados = new { reason = "RESTAURANT_TOO_BUSY" }; var data = JsonConvert.SerializeObject(dados); var result = new GenericSimpleResult(); var url = string.Format("{0}{1}/cancel", Constants.URL_ORDERS, id); var client = new RestClient(url); var request = new RestRequest(Method.POST); request.AddHeader("Authorization", string.Format("bearer {0}", token)); request.AddHeader("Content-Type", "application/json"); request.RequestFormat = DataFormat.Json; request.AddParameter("application/json", data, ParameterType.RequestBody); IRestResponse response = client.Execute(request); if (response.StatusCode == System.Net.HttpStatusCode.OK) { result.Success = true; } else { result.Message = response.Content; } return(result); }
public GenericSimpleResult Reject(string token, string order_id, string reason, string cancel_type) { var result = new GenericSimpleResult(); try { var data = new { reason, cancel_type }; var url = string.Format("{0}{1}{2}/reject", _urlBase, Constants.URL_ORDER, order_id); var client = new RestClient(url); var request = new RestRequest(Method.PUT); request.AddHeader("x-authorization", "Bearer " + token); request.AddHeader("Accept", "application/json"); request.AddParameter("application/json", JsonConvert.SerializeObject(data), ParameterType.RequestBody); IRestResponse response = client.Execute(request); if (response.StatusCode == System.Net.HttpStatusCode.OK) { result.Success = true; result.Json = response.Content; } else { result.Message = response.Content + " - " + response.StatusDescription; } } catch (Exception ex) { result.Message = ex.Message; } return(result); }
/// <summary> /// Alterando o status o pedido /// </summary> /// <param name="token"></param> /// <returns></returns> public GenericSimpleResult OrderStatus(string token, string id, string status) { var result = new GenericSimpleResult(); var data = new { status }; var url = string.Format("{0}{1}/{2}", _urlBase, Constants.URL_ORDER_STATUS, id); var client = new RestClient(url); var request = new RestRequest(Method.PUT); request.AddHeader("Authorization", string.Format("bearer {0}", token)); request.AddHeader("Content-Type", "application/json"); request.RequestFormat = DataFormat.Json; request.AddParameter("application/json", JsonConvert.SerializeObject(data), ParameterType.RequestBody); IRestResponse response = client.Execute(request); if (response.StatusCode == System.Net.HttpStatusCode.OK) { result.Success = true; } else { result.Message = response.StatusDescription + " - " + response.Content; } return(result); }
/// <summary> /// Sair da api /// </summary> /// <param name="token"></param> /// <returns></returns> public GenericSimpleResult Logout(string token) { var result = new GenericSimpleResult(); var url = string.Format("{0}{1}", _urlBase, Constants.URL_LOGOUT); var client = new RestClient(url); var request = new RestRequest(Method.DELETE); request.AddHeader("Authorization", string.Format("bearer {0}", token)); IRestResponse response = client.Execute(request); if (response.StatusCode == System.Net.HttpStatusCode.NoContent) { result.Success = true; } else if (response.StatusCode == System.Net.HttpStatusCode.NotFound) { result.Success = true; } else { result.Message = response.StatusDescription + " - " + response.Content; } return(result); }
public GenericSimpleResult OrdersStatus(string token, string network, string reference) { var data = new { }; var result = new GenericSimpleResult(); var url = string.Format("{0}{1}{2}/next", Constants.URL_BASE, Constants.URL_ORDER, reference); var client = new RestClient(url); var request = new RestRequest(Method.POST); request.AddHeader("Authorization", string.Format("bearer {0}", token)); request.AddHeader("X-NETWORK-ID", network); request.AddParameter("application/json", data, ParameterType.RequestBody); IRestResponse response = client.Execute(request); if (response.StatusCode == System.Net.HttpStatusCode.Accepted || response.StatusCode == System.Net.HttpStatusCode.NoContent) { result.Success = true; } else { result.Message = response.Content; } return(result); }
public GenericSimpleResult Cancel(string token, string orderId) { var result = new GenericSimpleResult(); try { var client = new RestClient(_url + Constants.ORDER_CANCEL + orderId); var request = new RestRequest(Method.POST); request.AddHeader("x-api-key", token); IRestResponse response = client.Execute(request); if (response.StatusCode == System.Net.HttpStatusCode.OK) { result.Success = true; result.Json = response.Content; } else { result.Message = response.Content + " - " + response.StatusDescription; } } catch (Exception ex) { result.Message = ex.Message; } return(result); }
public GenericSimpleResult Status(string token, string id, string status) { var result = new GenericSimpleResult(); try { var url = string.Format("{0}{1}status={2}&chave={3}&numeropedido={4}", Constants.URL, Constants.URL_ORDER_STATUS, status, token, id); var client = new RestClient(url); var request = new RestRequest(Method.GET); IRestResponse response = client.Execute(request); if (response.StatusCode == System.Net.HttpStatusCode.OK) { result.Success = true; result.Json = response.Content; } else { result.Message = response.Content + " - " + response.StatusDescription; } } catch (Exception ex) { result.Message = ex.Message; } return(result); }
/// <summary> /// Após o e-PDV receber os eventos do IFood, para cada evento que o e-PDV conseguiu realizar o parse e integrá-lo com sucesso, o e-PDV deve enviar uma requisição confirmando o recebimento dos eventos. /// Recomenda-se que o e-PDV envie uma lista de todos os eventos recebidos com sucesso de uma única vez.Importante salientar que apenas o id do evento é obrigatório. /// O IFood processará as notificações e removê-los da fila de eventos do e-PDV. /// Na próxima requisição que o e-PDV consulta por novos eventos, os eventos previamente confirmados não farão mais parte da resposta.. /// </summary> /// <param name="token"></param> /// <param name="events"></param> /// <returns></returns> public GenericSimpleResult EventAcknowledgment(string token, List <eventAcknowledgment> events) { var result = new GenericSimpleResult(); var url = string.Format("{0}{1}/{2}", _urlBase, Constants.VERSION_2, Constants.URL_EVENT_ACNOWLEDGMENT); var client = new RestClient(url); var request = new RestRequest(Method.POST); request.AddHeader("Authorization", string.Format("bearer {0}", token)); request.AddHeader("Content-Type", "application/json"); request.RequestFormat = DataFormat.Json; request.AddBody(events); //request.AddParameter("data", events, ParameterType.RequestBody); IRestResponse response = client.Execute(request); if (response.StatusCode == System.Net.HttpStatusCode.OK) { result.Success = true; } else { result.Message = response.Content; } return(result); }
/// <summary> /// Após buscar os pedidos, esse endpoint informa pro supermenu quais os pedidos que foram integrados. /// Os dados devem ser enviados em forma de array, diretamente no body (onde o type é JSON). /// </summary> /// <param name="token"></param> /// <param name="events"></param> /// <returns></returns> public GenericSimpleResult EventAcknowledgment(string token, List <eventAcknowledgment> events) { var result = new GenericSimpleResult(); var url = string.Format("{0}{1}", _urlBase, Constants.URL_EVENTS_ACKNOWLEDGMENT); var client = new RestClient(url); var request = new RestRequest(Method.POST); request.AddHeader("Authorization", token); request.AddHeader("Content-Type", "application/json"); request.RequestFormat = DataFormat.Json; request.AddBody(events); IRestResponse response = client.Execute(request); if (response.StatusCode == System.Net.HttpStatusCode.Created) { result.Success = true; } else { result.Message = response.StatusDescription; } return(result); }
/// <summary> /// Solicita o Cancelamento do Pedido /// </summary> /// <param name="token"></param> /// <param name="reference"></param> /// <param name="code"></param> /// <param name="detail"></param> /// <returns></returns> public GenericSimpleResult CancellationRequested(string token, string reference, short code, string detail) { var data = new { cancellationCode = code.ToString(), details = detail }; var result = new GenericSimpleResult(); var url = string.Format("{0}{1}/{2}/{3}/{4}", _urlBase, Constants.VERSION_3, Constants.URL_ORDER, reference, Constants.URL_ORDER_CANCELATION); var client = new RestClient(url); var request = new RestRequest(Method.POST); request.AddHeader("Authorization", string.Format("bearer {0}", token)); request.AddParameter("application/json", JsonConvert.SerializeObject(data), ParameterType.RequestBody); IRestResponse response = client.Execute(request); if (response.StatusCode == System.Net.HttpStatusCode.Accepted || response.StatusCode == System.Net.HttpStatusCode.NotFound) { result.Success = true; } else { result.Message = response.StatusDescription; } return(result); }
/// <summary> /// Informa ao IFood que o pedido foi integrado pelo e-PDV. /// Integração significa que o e-PDV foi capaz de realizar o parse do pedido e integrar em seu sistema. /// </summary> /// <param name="token"></param> /// <param name="reference"></param> /// <returns></returns> public GenericSimpleResult OrdersIntegration(string token, string reference) { var data = new { }; var result = new GenericSimpleResult(); var url = string.Format("{0}{1}/{2}/{3}/{4}", _urlBase, Constants.VERSION_2, Constants.URL_ORDER, reference, Constants.URL_ORDER_INTEGRATION); var client = new RestClient(url); var request = new RestRequest(Method.POST); request.AddHeader("Authorization", string.Format("bearer {0}", token)); request.AddParameter("application/json", data, ParameterType.RequestBody); IRestResponse response = client.Execute(request); if (response.StatusCode == System.Net.HttpStatusCode.Accepted) { result.Success = true; } else { result.Message = response.StatusDescription; } return(result); }
public GenericSimpleResult UpdateConta(string token, conta conta) { var result = new GenericSimpleResult(); try { var data = JsonConvert.SerializeObject(conta); var client = new RestClient(_url + Constants.ORDER_UPDATE_CONTA); var request = new RestRequest(Method.PUT); request.AddHeader("x-api-key", token); request.AddHeader("Content-Type", "application/json"); request.RequestFormat = DataFormat.Json; request.AddParameter("application/json", data, ParameterType.RequestBody); IRestResponse response = client.Execute(request); if (response.StatusCode == System.Net.HttpStatusCode.OK) { result.Success = true; result.Json = response.Content; } else { result.Message = response.Content + " - " + response.StatusDescription; } } catch (Exception ex) { result.Message = ex.Message; } return(result); }
public GenericSimpleResult Deny(string token, string orderId, string mensagem) { var result = new GenericSimpleResult(); try { var data = new { message = mensagem }; var client = new RestClient(_url + Constants.ORDER_DENY + orderId); var request = new RestRequest(Method.POST); request.AddHeader("x-api-key", token); request.AddParameter("application/json", JsonConvert.SerializeObject(data), ParameterType.RequestBody); IRestResponse response = client.Execute(request); if (response.StatusCode == System.Net.HttpStatusCode.OK) { result.Success = true; result.Json = response.Content; } else { result.Message = response.Content + " - " + response.StatusDescription; } } catch (Exception ex) { result.Message = ex.Message; } return(result); }
public GenericSimpleResult Status(string id) { var genericResult = new GenericSimpleResult(); try { var url = string.Format("{0}{1}/status", Constants.URL_ORDER, id); var client = new RestClient(url); var request = new RestRequest(Method.GET); request.AddHeader("Authorization", string.Format("bearer {0}", _token)); IRestResponse response = client.Execute(request); if (response.StatusCode == System.Net.HttpStatusCode.NoContent) { genericResult.Success = true; } else { genericResult.Message = response.Content; } genericResult.Json = response.Content; } catch (Exception ex) { genericResult.Message = ex.Message; } return(genericResult); }
public GenericSimpleResult Take(string token, string order_id, int cookingTime = 0) { var result = new GenericSimpleResult(); try { var url = string.Format("{0}{1}{2}/take/{3}", _urlBase, Constants.URL_ORDER, order_id, cookingTime); var client = new RestClient(url); var request = new RestRequest(Method.PUT); request.AddHeader("x-authorization", "Bearer " + token); request.AddHeader("Accept", "application/json"); IRestResponse response = client.Execute(request); if (response.StatusCode == System.Net.HttpStatusCode.OK) { result.Success = true; result.Json = response.Content; } else { result.Message = response.Content + " - " + response.StatusDescription; } } catch (Exception ex) { result.Message = ex.Message; } return(result); }
public GenericSimpleResult Pedido_Status(string token, int pedidoid, string status, int?entregadorid = null) { var result = new GenericSimpleResult(); var data = new { ped_status = status, ent_id = entregadorid }; var url = string.Format("{0}{1}/{2}", _urlBase, Constants.URL_PEDIDOS_STATUS, pedidoid); var client = new RestClient(url); var request = new RestRequest(Method.PUT); request.AddHeader("Accept", "application/json"); request.AddHeader("Content-Type", "application/json"); request.AddHeader("Auth-Token", token); request.RequestFormat = DataFormat.Json; request.AddParameter("application/json", JsonConvert.SerializeObject(data), ParameterType.RequestBody); IRestResponse response = client.Execute(request); if (response.StatusCode == System.Net.HttpStatusCode.NoContent || response.StatusCode == 0) { result.Success = true; } else { try { if (!string.IsNullOrEmpty(response.Content)) { var erro = JsonConvert.DeserializeObject <erro_result>(response.Content); result.Message = erro.descricao; } else { result.Message = response.ErrorMessage; } } catch { result.Message = response.Content; } } return(result); }
public GenericSimpleResult AlterarStatus(string id, string status, string motivo = "") { var data = new { pedidoId = id, status = status, motivoCancelamento = motivo }; var genericResult = new GenericSimpleResult(); try { var url = string.Format("{0}alterar/status", Constants.URL_ORDER); var client = new RestClient(url); var request = new RestRequest(Method.POST); request.AddHeader("Authorization", string.Format("Bearer {0}", _token)); request.AddParameter("application/json", JsonConvert.SerializeObject(data), ParameterType.RequestBody); IRestResponse response = client.Execute(request); if (response.StatusCode == System.Net.HttpStatusCode.OK) { genericResult.Success = true; } else { try { var retorno = JsonConvert.DeserializeObject <error_result>(response.Content); genericResult.Message = retorno.message; } catch { genericResult.Message = response.Content; } } genericResult.Json = response.Content; } catch (Exception ex) { genericResult.Message = ex.Message; } return(genericResult); }
public GenericSimpleResult Acknowledgment(string token, List <int> ids) { var result = new GenericSimpleResult(); try { var data = new { ids = ids }; var url = string.Format("{0}{1}", _urlBase, Constants.URL_Acknowledgment); var client = new RestClientBase(url); var request = new RestRequest(Method.POST); request.AddHeader("Authorization", string.Format("Bearer {0}", token)); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", JsonConvert.SerializeObject(data), ParameterType.RequestBody); IRestResponse response = client.Execute(request); if (response.StatusCode == System.Net.HttpStatusCode.OK) { var retorno = JsonConvert.DeserializeObject <retorno>(response.Content); if (retorno.success) { result.Success = true; } else { result.Message = retorno.message; } } else { result.Message = response.Content; } result.Json = response.Content; result.Request = client.requestResult; result.Response = client.responsetResult; result.StatusCode = response.StatusCode; } catch (Exception ex) { result.Message = ex.Message; } return(result); }
public GenericSimpleResult Status(string token, string codigo, string status) { var result = new GenericSimpleResult(); try { var data = new { codigo, status }; var url = string.Format("{0}{1}", _urlBase, Constants.URL_PEDIDO_STATUS); var client = new RestClient(url); var request = new RestRequest(Method.PUT); request.AddHeader("Authorization", "Bearer " + token); request.AddHeader("Accept", "application/json"); request.AddParameter("application/json", JsonConvert.SerializeObject(data), ParameterType.RequestBody); IRestResponse response = client.Execute(request); if (response.StatusCode == System.Net.HttpStatusCode.OK) { var resultStatus = JsonConvert.DeserializeObject <result_status>(response.Content); if (resultStatus.sucesso) { result.Success = true; } else { result.Message = resultStatus.erro; } result.Json = response.Content; } else { result.Message = response.Content + " - " + response.StatusDescription; } } catch (Exception ex) { result.Message = ex.Message; } return(result); }
public GenericSimpleResult Status(int id, int status) { var result = new GenericSimpleResult(); try { var data = new { id = id, status = status }; var url = string.Format("{0}{1}", _url, Constants.URL_ORDER_APPROVE); var client = new RestClient(url); var request = new RestRequest(Method.POST); request.AddHeader("Accept", "application/json"); request.RequestFormat = DataFormat.Json; request.AddParameter("application/json", JsonConvert.SerializeObject(data), ParameterType.RequestBody); IRestResponse response = client.Execute(request); if (response.StatusCode == System.Net.HttpStatusCode.OK) { if (response.Content == Constants.STATUS_PEDIDO_ATUALIZADO) { result.Success = true; result.Json = response.Content; } else { result.Message = response.Content; } } else { result.Message = response.Content + " - " + response.StatusDescription; } } catch (Exception ex) { result.Message = ex.Message; } return(result); }
public GenericSimpleResult Accept(string token, string id) { var result = new GenericSimpleResult(); var url = string.Format("{0}{1}/accept_pos_order", Constants.URL_ORDERS, id); var client = new RestClient(url); var request = new RestRequest(Method.POST); request.AddHeader("Authorization", string.Format("bearer {0}", token)); IRestResponse response = client.Execute(request); if (response.StatusCode == System.Net.HttpStatusCode.NoContent) { result.Success = true; } else { result.Message = response.Content; } return(result); }
public GenericSimpleResult AlterarStatus(string id, int status, int tempoParaEntrega = 0, string entregadorNome = "", string entregadorTelefone = "") { var data = new { id = id, Status = status, TempoParaEntrega = tempoParaEntrega, EntregadorNome = entregadorNome, EntregadorTelefone = entregadorTelefone, }; var genericResult = new GenericSimpleResult(); try { var url = string.Format("{0}status", Constants.URL_ORDER); var client = new RestClient(url); var request = new RestRequest(Method.PUT); request.AddHeader("Authorization", string.Format("bearer {0}", _token)); request.AddParameter("application/json", JsonConvert.SerializeObject(data), ParameterType.RequestBody); IRestResponse response = client.Execute(request); if (response.StatusCode == System.Net.HttpStatusCode.NoContent) { genericResult.Success = true; } else { genericResult.Message = response.Content; } genericResult.Json = response.Content; } catch (Exception ex) { genericResult.Message = ex.Message; } return(genericResult); }
public GenericSimpleResult Status(string id, int status) { var result = new GenericSimpleResult(); try { var body = "{" + string.Format("\r\n \"id\": \"{0}\",\r\n \"status\": {1}\r\n", id, status) + "}"; var client = new RestClient(_url); var request = new RestRequest(Method.PUT); request.AddHeader("Content-Type", "application/json"); request.AddHeader("Authorization", _token); request.AddParameter("application/json", body, ParameterType.RequestBody); IRestResponse response = client.Execute(request); if (response.StatusCode == System.Net.HttpStatusCode.OK) { result.Success = true; result.Json = response.Content; } else { try { var result_order = JsonConvert.DeserializeObject <result_status>(response.Content); result.Message = result_order.message; } catch { result.Message = response.Content; } } } catch (Exception ex) { result.Message = ex.Message; } return(result); }
public GenericSimpleResult Status(string codPedido, string status) { var result = new GenericSimpleResult(); try { var url = string.Format("{0}{1}?{2}&codPedido={3}&statusProcessamento={4}", _urlBase, Constants.ORDER_CONFIRMAR, _parametros, codPedido, status); var client = new RestClient(url); var request = new RestRequest(Method.GET); request.AddHeader("Accept", "application/json"); IRestResponse response = client.Execute(request); if (response.StatusCode == System.Net.HttpStatusCode.OK) { var result_order = JsonConvert.DeserializeObject <wspdvresponse <bool> >(response.Content); if (result_order != null && result_order.wspdvResponse != null && result_order.wspdvResponse.responseBody) { result.Success = true; result.Json = response.Content; } else { result.Message = result_order.wspdvResponse.responseMessage; } } else { result.Message = response.Content + " - " + response.StatusDescription; } } catch (Exception ex) { result.Message = ex.Message; } return(result); }
public GenericSimpleResult CreateOrder(string client_id, string storeId, int produtoId, int quantidade) { var result = new GenericSimpleResult(); try { dynamic inputs = null; var data = new { cliente_id = client_id, loja_id = storeId, produto_id = produtoId, quantidade = quantidade, gorjeta = 2, observacao = "Observacao de um pedido com insumos.", inputs = inputs }; //JsonConvert.SerializeObject(data) var json = @"{ ""cliente_id"": 18, ""loja_id"": 402, ""produto_id"": 247004, ""quantidade"": 3, ""inputs"": [ { ""id"": 7351, ""quantidade"": 1 }, { ""id"": 7352, ""quantidade"": 1 } ], ""gorjeta"": 2, ""observacao"": ""Observacao de um pedido com insumos."" }"; json = @"{ ""cliente_id"": 18, ""loja_id"": 402, ""produto_id"": 251719, ""quantidade"": 3, ""inputs"": [ { ""id"": 7351, ""quantidade"": 1 }, { ""id"": 7352, ""quantidade"": 1 } ], ""gorjeta"": 2, ""observacao"": ""Observacao de um pedido com insumos."" }"; var url = "https://n8n.packk.com.br/webhook/create-order"; //var url = "https://webhook.site/381c95d4-5fa7-4027-913c-7f1a21a2b87c"; var client = new RestClient(url); client.Timeout = -1; var request = new RestRequest(Method.POST); request.AddHeader("Authorization", "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJhdWQiOiIyIiwianRpIjoiNTFkZjAyMzE1OTU2MjhjMGI4ZDVlZDc1Njg3YmFjMWZjZDlmMzA3ZGFmMWM0OWM0ZTAwM2NkZjcwMDA5M2YwZjdkNzY0ZmI5YmEzNzMxN2EiLCJpYXQiOjE2NDc1NDc4MjUuODM4NDQ0LCJuYmYiOjE2NDc1NDc4MjUuODM4NDg0LCJleHAiOjE2NzkwODM4MjUuODI1MTc2LCJzdWIiOiIiLCJzY29wZXMiOltdfQ.Uc56Usz3OFj45q1Z2oqKkcp7uV2PK1Z-dBNLxGZetCGpxSF42fAAy446SYpyIP6sh6m_OaFJ-bS6lRmtcAC1h18ZwTGeBoW5kqfs8IWEtej7gPkc3yPqJJY4xokTjsuBU4jKiRwprQLXlDwBbpVpIgjUmvk1qTkM3ZdG9ttb5NP190-igSf8MSwcBAZarHWsI7OkMXxmXluzcnBJT0wnkcebVr_mTCGdAxwirvulGyF3zLHJcQgnqrA0bnhq7GU0PpNBbMgyAynAvwdHHoIq1ZhHuZ9bLYWB4kOdvK2cnmzStpohCXFkT6hcKMHrL2ssPRk9VTm6Il9L_my90peWYOe32CkCVMWohOUfnfPMPY1ncpjlDf9nEv2CQ7ezvkGu6eOHOCxk7WwNz6lTWhKkJ8HgVQ4EpP2_sHJLqAHbJO0fJ96u4iIGKNKk8IO0PZgNJo-8KqmupgDLrdJEDzEfmRkU3LQTj23OkJZVQjrFtua3poc-aB-mFc17Cqi5QSKQduho23PAFsJNhG8MQHUsnlfxqVswEvZTZQ1Uy19qX6DAM54i5y2CJGfcBtJjCzriT6-Iz1HqfQHBUtGZOCGhyR8xfbtGbkU2LjGU5jadR7YD-K8USYuZFF07fgr49tdteohMExVnFBrRKz_jXnljpa41ALI8C8SVBgeKFlRakfY"); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", json, ParameterType.RequestBody); IRestResponse responseToken = client.Execute(request); if (responseToken.StatusCode == System.Net.HttpStatusCode.OK) { var resultJson = responseToken.Content; result.Success = true; } else { result.Message = responseToken.Content; } result.StatusCode = responseToken.StatusCode; } catch (Exception ex) { result.Message = ex.Message; } return(result); }