예제 #1
0
        public async Task <ServerResponse <bool> > SendOrders(ICollection <ApiModel.Order> orders)
        {
            var result = new ServerResponse <bool>();

            try
            {
                if (orders.Count != 0)
                {
                    var requestResult = await _orderApi.SyncOrdersAsync(orders, Settings.CurrentUser?.Name);

                    result.Data = requestResult;
                }
                else
                {
                    result.Data = true;
                }
                result.Status = Enums.ResponseStatus.Ok;
            }
            catch (NoInternetConnectionException)
            {
                result.Status  = Enums.ResponseStatus.NotConnected;
                result.Message = "No connection to the server";
            }
            catch (Exception ex)
            {
                result.Status  = Enums.ResponseStatus.Error;
                result.Message = ex.Message;
            }
            return(result);
        }