public TransactionDetailViewModel(TransEntry item)
 {
     if (item != null)
     {
         Item = item;
     }
 }
        private async void SaveTransaction(TransEntry entity)
        {
            var client  = new RestClient($"http://{Constants.URL}");
            var request = new RestRequest("/api/transentry", Method.POST);

            request.AddJsonBody(entity);
            var response = await client.ExecutePostTaskAsync(request);

            if (response.StatusCode != HttpStatusCode.OK)
            {
                Debug.WriteLine(JsonConvert.SerializeObject(response));
            }
        }
        private async Task <TransEntry> GetTransaction(TransEntry item)
        {
            var client   = new RestClient($"http://{Constants.URL}");
            var request  = new RestRequest($"/api/transentry/{item.Id}", Method.GET);
            var response = await client.ExecuteGetTaskAsync(request);

            if (response.StatusCode != HttpStatusCode.OK)
            {
                Debug.WriteLine(JsonConvert.SerializeObject(response));
            }

            return(JsonConvert.DeserializeObject <TransEntry>(response.Content));
        }
        public TransactionDetailViewModel()
        {
            Title         = "Transaction Detail";
            Properties    = new ObservableCollection <Property>();
            Categories    = new ObservableCollection <Category>();
            SubCategories = new ObservableCollection <SubCategory>();
            Item          = new TransEntry {
                Id = -1, EntryDate = DateTime.Now
            };

            LoadItemsCommand = new Command(async() => await ExecuteLoadItemsCommand());

            MessagingCenter.Subscribe <TransactionDetailPage, TransEntry>(this, "AddItem", async(obj, item) =>
            {
                var _item = item as TransEntry;
                SaveTransaction(_item);
            });
        }