예제 #1
0
        public void AddHarvest(Harvest harvest)
        {
            var record = new Record()
            {
                Message = $"Added new harvest: {harvest.FullString()}: ",
            };

            _harvests.Add(harvest);
            _context.Harvests.Add(harvest);
            _context.Records.Add(record);
            HarvestChanged?.Invoke();
        }
예제 #2
0
 public void AddHarvestAsync(Harvest harvest)
 {
     Task.Factory.StartNew(() =>
     {
         var record = new Record()
         {
             Message = $"Added new harvest: {harvest.FullString()}: ",
         };
         _context.Harvests.Add(harvest);
         _context.Records.Add(record);
         _context.SaveChanges();
     });
     _harvests.Add(harvest);
     HarvestChanged?.Invoke();
 }