Esempio n. 1
0
 public IActionResult EditSeed(NewSeedVm model)
 {
     if (ModelState.IsValid)
     {
         _seedService.UpdateSeed(model);
         return(RedirectToAction("Index"));
     }
     return(View(model));
 }
Esempio n. 2
0
        public void AddSeed(NewSeedVm newSeed, string userId)
        {
            var seed = _mapper.Map <Seed>(newSeed);

            seed.TypeProductId = 2;
            seed.UserId        = userId;
            seed.CurrentAmount = seed.Capacity;

            _genericRepository.Add <Seed>(seed);
        }
Esempio n. 3
0
        public IActionResult AddSeed(NewSeedVm model)
        {
            if (ModelState.IsValid)
            {
                _seedService.AddSeed(model, userId);
                return(RedirectToAction("Index"));
            }

            return(View(model));
        }
Esempio n. 4
0
        public IActionResult AddSeed()
        {
            var modelWarehouses     = _warehouseService.GetAllWarehouseForList(userId).Warehouses;
            var warehouseSelectList =
                modelWarehouses.Select(f => new SelectListItem(f.Name, Convert.ToString(f.Id))).ToList();
            var viewModel = new NewSeedVm()
            {
                Warehouses = warehouseSelectList
            };

            return(View(viewModel));
        }
Esempio n. 5
0
        public void UpdateSeed(NewSeedVm editSeed)
        {
            var seed = _mapper.Map <Seed>(editSeed);

            _seedRepository.UpdateSeed(seed);
        }