//[ValidateAntiForgeryToken]
        public async Task <ActionResult <Expense> > Edit(string expId, [FromBody] ExpenseToUpdateDto updatedExp)
        {
            Expense exp = await _expenseRepository.GetExpenseById(expId);

            var     updated = _mapper.Map <ExpenseToUpdateDto, Expense>(updatedExp, exp);
            Expense final   = await _expenseRepository.Update(updated);

            return(Ok(final));
        }
        public async Task <Expense> UpdateExpenseAsync(string id, ExpenseToUpdateDto exp2upt)
        {
            string        json    = JsonConvert.SerializeObject(exp2upt);
            StringContent content = new StringContent(json, Encoding.UTF8, "application/json");

            response = await client.PutAsync("api/expense/" + id, content);

            if (response.IsSuccessStatusCode)
            {
                Expense fexp = await response.Content.ReadAsAsync <Expense>();

                return(fexp);
            }
            Console.WriteLine("error while updateexpenseasync");
            return(null);
        }
        public async Task <IActionResult> Edit(string id, [Bind("Content, Price, Date")] ExpenseToUpdateDto expense2update)
        {
            var res = await service.UpdateExpenseAsync(id, expense2update);

            return(RedirectToAction("Index"));
        }