예제 #1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name")] Occupation occupation)
        {
            if (id != occupation.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(occupation);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!OccupationExists(occupation.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(occupation));
        }
예제 #2
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Balance,EmployeeId")] BalanceSheet balanceSheet)
        {
            if (id != balanceSheet.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(balanceSheet);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!BalanceSheetExists(balanceSheet.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["EmployeeId"] = new SelectList(_context.Employees, "Id", "Id", balanceSheet.EmployeeId);
            return(View(balanceSheet));
        }
예제 #3
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,OccupationId")] Employee employee)
        {
            if (id != employee.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(employee);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!EmployeeExists(employee.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["OccupationId"] = new SelectList(_context.Occupation, "Id", "Id", employee.OccupationId);
            return(View(employee));
        }