public IActionResult EditSeed(NewSeedVm model) { if (ModelState.IsValid) { _seedService.UpdateSeed(model); return(RedirectToAction("Index")); } return(View(model)); }
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); }
public IActionResult AddSeed(NewSeedVm model) { if (ModelState.IsValid) { _seedService.AddSeed(model, userId); return(RedirectToAction("Index")); } return(View(model)); }
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)); }
public void UpdateSeed(NewSeedVm editSeed) { var seed = _mapper.Map <Seed>(editSeed); _seedRepository.UpdateSeed(seed); }