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)); }
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)); }
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); }