public async Task <IActionResult> Save(ExpenseDto expense)
        {
            using (var client = new HttpClient())
            {
                client.BaseAddress = new Uri("https://expensestrackerservices3.azurewebsites.net");
                var request = new ExpenseRequest
                {
                    UserId          = expense.UserId,
                    ExpenseId       = expense.ExpenseId,
                    Description     = expense.Description,
                    ExpendedValue   = expense.ExpendedValue,
                    TransactionDate = expense.TransactionDate
                };
                var content = new StringContent(JsonConvert.SerializeObject(request), Encoding.UTF8, "application/json");

                var responseTask = client.PutAsync($"/api/Expenses/edit", content);
                responseTask.Wait();

                var result = responseTask.Result;
                if (result.IsSuccessStatusCode)
                {
                    var readTask = await result.Content.ReadAsStringAsync();

                    var response = JsonConvert.DeserializeObject <ExpensesResponse>(readTask);

                    if (!response.IsValid())
                    {
                        ModelState.AddModelError("ErrorMessage", response.ValidationMessage);
                    }
                }
                else //web api sent error response
                {
                    ModelState.AddModelError("ErrorMessage", "Server error. Please contact administrator.");
                }
            }
            return(RedirectToAction("Index", "Reports"));
        }
        public async Task <IActionResult> Delete(string expenseId, string userId)
        {
            using (var client = new HttpClient())
            {
                client.BaseAddress = new Uri("https://expensestrackerservices3.azurewebsites.net");
                var request = new ExpenseRequest {
                    UserId = userId, ExpenseId = expenseId
                };
                var content = new StringContent(JsonConvert.SerializeObject(request), Encoding.UTF8, "application/json");

                var responseTask = client.DeleteAsync($"/api/Expenses/delete?userBudget.userId={userId}&userBudget.ExpenseId={expenseId}");
                responseTask.Wait();

                var result = responseTask.Result;
                if (result.IsSuccessStatusCode)
                {
                    var readTask = await result.Content.ReadAsStringAsync();

                    var response = JsonConvert.DeserializeObject <ExpensesResponse>(readTask);

                    if (response.IsValid())
                    {
                        return(RedirectToAction("Index", "Reports"));
                    }
                    else
                    {
                        ModelState.AddModelError("ErrorMessage", response.ValidationMessage);
                    }
                }
                else //web api sent error response
                {
                    ModelState.AddModelError("ErrorMessage", "Server error. Please contact administrator.");
                }
            }
            return(RedirectToAction("Index", "Reports"));
        }