public async Task <IActionResult> Edit(int?product, short?year, byte?month, [Bind("Product,Year,Month,Expected_Volume")] Product_ForecastEditModel productForecastEdit) { var productForecast = new Product_Forecast { Product = productForecastEdit.Product, Year = productForecastEdit.Year, Month = productForecastEdit.Month, Expected_Volume = productForecastEdit.Expected_Volume }; if (product != productForecast.Product || year != productForecast.Year || month != productForecast.Month) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(productForecast); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ProductForecastExists(productForecast.Product, productForecast.Year, productForecast.Month)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(productForecast)); }
public async Task <IActionResult> Create([Bind("Product,Year,Month,Expected_Volume")] Product_ForecastCreateModel createModel) { var forecast = new Product_Forecast { Product = createModel.Product, Year = createModel.Year, Month = createModel.Month, Expected_Volume = createModel.Expected_Volume }; if (ModelState.IsValid) { _context.Add(forecast); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(createModel)); }