Пример #1
0
        public FinanceItemEntity SaveNewFinanceItem(FinanceItemEntity newEntity)
        {
            _storage.FinanceItemRepository.OpenConnection();
            FinanceItemEntity entity = _storage.FinanceItemRepository.Add(newEntity);
            _storage.FinanceItemRepository.SaveChanges();
            _storage.FinanceItemRepository.CloseConnection();

            return entity;
        }
Пример #2
0
 public FinanceItem(FinanceItemEntity entity)
 {
     Id = entity.Id;
     ItemType = entity.ItemType;
     Name = entity.Name;
     Date = entity.Date;
     Category = entity.Category != null
         ? entity.Category.Name
         : string.Empty;
     Milestone = entity.Milestone != null
         ? entity.Milestone.Name
         : string.Empty;
     Amount = entity.Amount;
     IsPlanned = entity.IsPlanned;
 }
Пример #3
0
        public bool UpdateFinanceItem(FinanceItemEntity entity)
        {
            _storage.FinanceItemRepository.OpenConnection();
            var updateResult = _storage.FinanceItemRepository.Update(entity);
            _storage.FinanceItemRepository.SaveChanges();
            _storage.FinanceItemRepository.CloseConnection();

            return updateResult;
        }