Ejemplo n.º 1
0
        public async Task <IActionResult> Edit(int id, [Bind("ReleacePlanId,ProductId,OutputPlan,Price")] ReleacePlan releacePlan)
        {
            if (id != releacePlan.ReleacePlanId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(releacePlan);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ReleacePlanExists(releacePlan.ReleacePlanId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ProductId"] = new SelectList(_context.Products, "ProductsId", "ProductsId", releacePlan.ProductId);
            return(View(releacePlan));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Create([Bind("ReleacePlanId,ProductId,OutputPlan,Price")] ReleacePlan releacePlan)
        {
            if (ModelState.IsValid)
            {
                _context.Add(releacePlan);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ProductId"] = new SelectList(_context.Products, "ProductsId", "ProductsId", releacePlan.ProductId);
            return(View(releacePlan));
        }