Example #1
0
        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));
        }
Example #2
0
        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));
        }
Example #3
0
        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));
        }