Ejemplo n.º 1
0
 private void SavePriceProduct()
 {
     using (var db = new CowRationContext())
     {
         foreach (var item in storages)
         {
             Korm korm = db.Korms.Where(k => k.Id_korm == item.Id).FirstOrDefault();
             korm.Price_korm = item.Price;
         }
         db.SaveChanges();
     }
 }
Ejemplo n.º 2
0
        public async Task <IActionResult> AddKorms(KormForManagment kormModel)
        {
            var characterizations = new List <CharacterizationIndexFood>();

            foreach (var characteristicIndex in kormModel.CharacterizationIndexFoods)
            {
                var catalogIndex = await context.GetCatalogIndexByName(characteristicIndex.NameIndex);

                characterizations.Add(new CharacterizationIndexFood
                {
                    CatalogIndexFoodId = catalogIndex.Id,
                    Value = characteristicIndex.Value,
                });
            }
            var korm = new Korm {
                Name = kormModel.Name, Price = kormModel.Price, CharacterizationIndexFoods = characterizations
            };

            context.AddKorm(korm);
            return(Ok());
        }
Ejemplo n.º 3
0
 public void UpdateKorm(int id, Korm korm)
 {
     throw new System.NotImplementedException();
 }
Ejemplo n.º 4
0
        public async void AddKorm(Korm korm)
        {
            await context.Korms.AddAsync(korm);

            await context.SaveChangesAsync();
        }