public async Task <IActionResult> Edit(int id, [Bind("AssociateCommissionId,AssociateId,AssociateCommission1,EffectiveDate,CreatedDate,CreatedBy,LastUpdateDate,LastUpdatedBy,CommissionSplitId")] AssociateCommission associateCommission) { if (id != associateCommission.AssociateCommissionId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(associateCommission); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!AssociateCommissionExists(associateCommission.AssociateCommissionId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["AssociateId"] = new SelectList(_context.Associates, "AssociateId", "AssociateFirstName", associateCommission.AssociateId); return(View(associateCommission)); }
public async Task <IActionResult> Create([Bind("AssociateCommissionId,AssociateId,AssociateCommission1,EffectiveDate,CreatedDate,CreatedBy,LastUpdateDate,LastUpdatedBy,CommissionSplitId")] AssociateCommission associateCommission) { if (ModelState.IsValid) { _context.Add(associateCommission); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["AssociateId"] = new SelectList(_context.Associates, "AssociateId", "AssociateLastName", associateCommission.AssociateId); ViewData["CommissionSplitId"] = new SelectList(_context.CommissionSplits, "CommissionSplitId", "AssociateSplitPortion", associateCommission.CommissionSplitId); return(View(associateCommission)); }