Beispiel #1
0
        protected async override Task UpdateAsync(FarmingEntities db)
        {
            await _cowsViewModel.UpdateAsync();

            var productivities = await db.Productivities.ToArrayAsync();

            ProductivityViewModel productivity;

            foreach (var p in productivities)
            {
                productivity = new ProductivityViewModel()
                {
                    Id              = p.Id,
                    CowId           = p.CowId,
                    UchtenoLaktacij = p.UchtenoLaktacij,
                    UdojKg          = p.UdojKg,
                    ZhirProz        = p.ZhirProz,
                    BelokProz       = p.BelokProz,
                    Date            = p.Date,
                    Cow             = _cowsViewModel.Models.FirstOrDefault(c => c.Id == p.CowId)
                };

                Models.Add(productivity);
            }
        }
Beispiel #2
0
        protected async override Task UpdateAsync(FarmingEntities db)
        {
            await _cowsViewModel.UpdateAsync();

            await _gendersViewModel.UpdateAsync();

            var priplods = await db.Priplods.ToArrayAsync();

            PriplodViewModel priplod;

            foreach (var p in priplods)
            {
                priplod = new PriplodViewModel()
                {
                    Id       = p.Id,
                    CowId    = p.CowId,
                    GenderId = p.GenderId,
                    Weight   = p.Weight,
                    Gender   = _gendersViewModel.Models.FirstOrDefault(g => g.Id == p.GenderId),
                    Mother   = _cowsViewModel.Models.FirstOrDefault(c => c.Id == p.CowId)
                };

                Models.Add(priplod);
            }
        }
        protected async override Task UpdateAsync(FarmingEntities db)
        {
            await _cowsViewModel.UpdateAsync();

            await _methodsSluchkiViewModel.UpdateAsync();

            var reproductions = await db.Reproductions.ToArrayAsync();

            foreach (var r in reproductions)
            {
                Models.Add(new ReproductionViewModel()
                {
                    Id              = r.Id,
                    CowId           = r.CowId,
                    MethodSluchkiId = r.MethodSluchkiId,
                    BullId          = r.BullId,
                    DateOsemeneniya = r.DateOsemeneniya,
                    ChisloSuhihDney = r.ChisloSuhihDney,
                    SerPeriod       = r.SerPeriod,
                    DateOtela       = r.DateOtela,
                    Bull            = _cowsViewModel.BullsViewModel.Models.FirstOrDefault(b => b.Id == r.BullId),
                    Cow             = _cowsViewModel.Models.FirstOrDefault(c => c.Id == r.CowId),
                    MethodSluchki   = _methodsSluchkiViewModel.Models.FirstOrDefault(m => m.Id == r.MethodSluchkiId)
                });
            }
        }
Beispiel #4
0
        protected async override Task UpdateAsync(FarmingEntities db)
        {
            await _cowsViewModel.UpdateAsync();

            var retirements = await db.Retirements.ToArrayAsync();

            RetirementViewModel retirement;

            foreach (var r in retirements)
            {
                retirement = new RetirementViewModel()
                {
                    Id     = r.Id,
                    CowId  = r.CowId,
                    Date   = r.Date,
                    Reason = r.Reason,
                    Cow    = _cowsViewModel.Models.FirstOrDefault(c => c.Id == r.CowId)
                };

                Models.Add(retirement);
            }
        }