public async Task <IActionResult> Edit(int id, [Bind("UnitValuationPlanID,FullName,Profit,Salary,UnitValuationFactID")] UnitValuationPlan unitValuationPlan) { if (id != unitValuationPlan.UnitValuationPlanID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(unitValuationPlan); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!UnitValuationPlanExists(unitValuationPlan.UnitValuationPlanID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["UnitValuationFactID"] = new SelectList(_context.UnitValuationFacts, "UnitValuationFactID", "UnitValuationFactID", unitValuationPlan.UnitValuationFactID); return(View(unitValuationPlan)); }
public async Task <IActionResult> Create([Bind("UnitValuationPlanID,FullName,Profit,Salary,UnitValuationFactID")] UnitValuationPlan unitValuationPlan) { if (ModelState.IsValid) { _context.Add(unitValuationPlan); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["UnitValuationFactID"] = new SelectList(_context.UnitValuationFacts, "UnitValuationFactID", "UnitValuationFactID", unitValuationPlan.UnitValuationFactID); return(View(unitValuationPlan)); }