public ExpenseViewModel(Expense entry)
     : this()
 {
     Entry = entry;
     Contractor = entry.Contractor;
     if (!entry.EconomicEvent.IsInDictionary)
         EconomicEventDescription = entry.EconomicEvent.Description;
     if (!entry.Comment.IsInDictionary)
         CommentText = entry.Comment.Text;
     ButtonContent = "Edytuj";
     Title = $"Edycja wpisu {entry.EvidenceNumber}";
     ButtonCommand = new RelayCommand(EditEntry);
 }
 public ExpenseViewModel()
 {
     Header = "Wydatki (koszty)";
     var startOfTheMonth = new DateTime(DateTime.Today.Year, DateTime.Today.Month, 1);
     int count;
     using (var context = new LedgerContext())
     {
         EconomicEvents = context.LedgerDictionaries.OfType<EconomicEvent>()
             .Where(x => x.IsInDictionary && x.ForExpense).ToList();
         Comments = context.LedgerDictionaries.OfType<Comment>()
             .Where(x => x.IsInDictionary && x.ForExpense).ToList();
         count = context.Entries
             .Count(x => x.Date >= startOfTheMonth);
     }
     Entry = new Expense
     {
         Date = DateTime.Today,
         EconomicEventId = EconomicEvents.First().Id,
         CommentId = Comments.First().Id,
         EvidenceNumber = $"{count + 1}/{ DateTime.Today.Month}/{DateTime.Today.Year}"
     };
 }