Exemplo n.º 1
0
 public void EditIncome(IncomeEditModel model)
 {
     using (var httpClient = new HttpClientExtended())
     {
         var dto = AutoMapper.Mapper.Map <PersonalFinanceManager.DTOs.Income.IncomeDetails>(model);
         httpClient.Put($"/Income/Edit/{model.Id}", dto);
     }
 }
        /// <summary>
        /// Initialize the Create form.
        /// </summary>
        /// <returns></returns>
        public ActionResult Create()
        {
            AccountBasicInfo();

            var incomeModel = new IncomeEditModel();

            incomeModel.DateIncome = DateTime.Today;

            return(View(incomeModel));
        }
Exemplo n.º 3
0
        public IncomeEditModel GetById(int id)
        {
            IncomeEditModel result = null;

            using (var httpClient = new HttpClientExtended())
            {
                var response = httpClient.GetSingle <PersonalFinanceManager.DTOs.Income.IncomeDetails>($"/Income/Get/{id}");
                result = AutoMapper.Mapper.Map <IncomeEditModel>(response);
            }
            return(result);
        }
        public ActionResult Edit(IncomeEditModel incomeEditModel)
        {
            if (ModelState.IsValid)
            {
                var accountId = GetCurrentAccount();
                incomeEditModel.AccountId = accountId;

                _incomeService.EditIncome(incomeEditModel);

                return(RedirectToAction("Index"));
            }
            return(View(incomeEditModel));
        }