/// <summary> /// 更新-EF-DB /// </summary> /// <param name="newdata"></param> /// <param name="olddata"></param> public void Edit(AccountBook newdata, AccountBook olddata) { olddata.Categoryyy = newdata.Categoryyy; olddata.Amounttt = newdata.Amounttt; olddata.Dateee = newdata.Dateee; olddata.Remarkkk = newdata.Remarkkk; }
/// <summary> /// 新增-傳入 ViewModel 資料 /// </summary> /// <param name="MoneyAdd"></param> public void Add(MoneyAddViewModels MoneyAdd) { var result = new AccountBook() { Categoryyy = MoneyAdd.Category, Amounttt = MoneyAdd.Amount, Dateee = MoneyAdd.BillingDate, Remarkkk = MoneyAdd.Memo }; Add(result); }
/// <summary> /// 明細 /// </summary> /// <param name="data"></param> /// <returns></returns> public MoneyAddViewModels Detail(AccountBook data) { var result = new MoneyAddViewModels() { Id = data.Id, Category = data.Categoryyy, Amount = data.Amounttt, BillingDate = data.Dateee, Memo = data.Remarkkk }; return(result); }
/// <summary> /// 編輯 /// </summary> /// <param name="MoneyAdd"></param> /// <param name="olddata"></param> public void Edit(MoneyAddViewModels MoneyAdd, AccountBook olddata) { var newdata = new AccountBook() { Id = MoneyAdd.Id, Categoryyy = MoneyAdd.Category, Amounttt = MoneyAdd.Amount, Dateee = MoneyAdd.BillingDate, Remarkkk = MoneyAdd.Memo }; Edit(newdata, olddata); }
/// <summary> /// 刪除-EF-DB /// </summary> /// <param name="data"></param> public void Delete(AccountBook data) { _db.AccountBook.Remove(data); }
/// <summary> /// 新增-EF-DB /// </summary> /// <param name="money"></param> public void Add(AccountBook data) { data.Id = Guid.NewGuid(); _db.AccountBook.Add(data); }