public ActionResult Add(AccountingNoteViewModel source) { if (ModelState.IsValid) { _accountingNoteService.Add(source); _accountingNoteService.Save(); } return(View()); }
public void Add(AccountingNoteViewModel source) { var distin = new AccountBook() { Id = Guid.NewGuid(), Categoryyy = int.Parse(source.CostType), Amounttt = source.CostMoney, Dateee = source.CostDate, Remarkkk = source.Remark }; dbContext.AccountBook.Add(distin); }
public ActionResult ShowAccounting() { List <AccountingNoteViewModel> accountingNote = new List <AccountingNoteViewModel>(); var fromDb = _accountingNoteService.GetAll(); foreach (var item in fromDb) { var result = new AccountingNoteViewModel() { CostType = item.Categoryyy == CostTypeEnum.支出.GetHashCode() ? CostTypeEnum.支出.ToString() : CostTypeEnum.收入.ToString(), CostDate = item.Dateee, CostMoney = item.Amounttt, Remark = item.Remarkkk }; accountingNote.Add(result); } return(View(accountingNote)); }