コード例 #1
0
 public void AddItem(int userId, LogEntry item)
 {
     var entry = new MoneyFlow
     {
         Id = 0,
         Category = item.Category.ToTitleCase(),
         Subcategory = (string.IsNullOrEmpty(item.Subcategory)) ? string.Empty : item.Subcategory.ToTitleCase(),
         Credit = (item.Direction == "credit") ? item.Value : 0m,
         Debit = (item.Direction == "debit") ? item.Value : 0m,
         Date = DateTime.Now,
         Item = item.Description
     };
     _moneyFlowRepository.SaveItem(userId, entry);
 }
コード例 #2
0
 public void SaveItem(int userId, MoneyFlow moneyFlow)
 {
     if (moneyFlow.Id == 0)
     {
         moneyFlow.Date = DateTime.Now;
         GetUser(userId).MoneyFlows.Add(moneyFlow);
         _context.SubmitChanges();
     }
     else if (_context.MoneyFlows.GetOriginalEntityState(moneyFlow) == null)
     {
         _context.MoneyFlows.Attach(moneyFlow);
         _context.MoneyFlows.Context.Refresh(RefreshMode.KeepCurrentValues, moneyFlow);
         _context.MoneyFlows.Context.SubmitChanges();
     }
 }
コード例 #3
0
 partial void DeleteMoneyFlow(MoneyFlow instance);
コード例 #4
0
 partial void UpdateMoneyFlow(MoneyFlow instance);
コード例 #5
0
 partial void InsertMoneyFlow(MoneyFlow instance);
コード例 #6
0
		private void detach_MoneyFlows(MoneyFlow entity)
		{
			this.SendPropertyChanging();
			entity.User1 = null;
		}
コード例 #7
0
		private void attach_MoneyFlows(MoneyFlow entity)
		{
			this.SendPropertyChanging();
			entity.User1 = this;
		}
コード例 #8
0
 public void SaveItem(int userId, MoneyFlow moneyFlow)
 {
     throw new NotImplementedException();
 }