public async Task <IActionResult> Create([Bind("Id,Name")] Occupation occupation) { if (ModelState.IsValid) { _context.Add(occupation); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(occupation)); }
public async Task <IActionResult> Create([Bind("Id,Balance,EmployeeId")] BalanceSheet balanceSheet) { if (ModelState.IsValid) { _context.Add(balanceSheet); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["EmployeeId"] = new SelectList(_context.Employees, "Id", "Id", balanceSheet.EmployeeId); return(View(balanceSheet)); }
public async Task <IActionResult> Create([Bind("Id,Name,OccupationId")] Employee employee) { if (ModelState.IsValid) { _context.Add(employee); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["OccupationId"] = new SelectList(_context.Occupation, "Id", "Id", employee.OccupationId); return(View(employee)); }