Ejemplo n.º 1
0
        public async Task <IActionResult> UpdateBill(UpdateAccountBillDto input)
        {
            input.CreateUserID      = Convert.ToInt32(User.FindFirstValue(ClaimTypes.Sid));;
            input.CreateDisPlayName = User.Identity.Name;
            var model = await _accountBillService.Update(input);

            return(Json(model));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Create(int Id)
        {
            UpdateAccountBillDto   model       = new UpdateAccountBillDto();
            IList <SelectListItem> BillTypelst = new List <SelectListItem>
            {
                new SelectListItem {
                    Value = BillTypeEnum.Income.ToString(), Text = "收入"
                },
                new SelectListItem {
                    Value = BillTypeEnum.Expense.ToString(), Text = "支出"
                }
            };

            var items = _itemsRepository.GetAll();
            List <SelectListItem> ItmsTypelst = new List <SelectListItem>
            {
                new SelectListItem {
                    Value = "", Text = ""
                }
            };

            foreach (var item in items)
            {
                ItmsTypelst.Add(new SelectListItem {
                    Value = item.Id.ToString(), Text = item.ItemType
                });
            }
            if (Id > 0)
            {
                var item = await _accountBillService.GetBillEntity(Convert.ToInt32(Id));

                model      = _mapper.Map(item, model);
                ViewBag.Id = item.Id;
                ViewBag.Hidden_ItemType = item.ItemType;
            }
            else
            {
                ViewBag.Id = 0;
            }
            ViewBag.BillTypelst = BillTypelst;
            ViewBag.ItmsTypelst = ItmsTypelst;

            return(View(model));
        }
Ejemplo n.º 3
0
        public async Task <ReturnValueModel> Update(UpdateAccountBillDto input)
        {
            string           strMessage = string.Empty;
            bool             IfSuccess  = true;
            ReturnValueModel model      = new ReturnValueModel();

            try
            {
                var bill = _mapper.Map <AccountBill>(input);
                await _repository.UpdateAsync(bill);

                await _unitOfWork.SaveChangesAsync();
            }
            catch (System.Exception ex)
            {
                IfSuccess  = false;
                strMessage = ex.Message;
            }
            model.IfSuccess = IfSuccess;
            model.Message   = strMessage;
            return(model);
        }