예제 #1
0
        public async Task <IActionResult> Create([Bind("Id,CompanyName,Website")] Company company)
        {
            if (ModelState.IsValid)
            {
                _context.Add(company);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(company));
        }
        public async Task <IActionResult> Create([Bind("Id,TaxCode,TaxPercentage")] TaxTable taxTable)
        {
            if (ModelState.IsValid)
            {
                _context.Add(taxTable);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(taxTable));
        }
예제 #3
0
        public async Task <IActionResult> Create([Bind("Id,Year,EmployeeId,CalculatedTax")] SalaryPayment salaryPayment)
        {
            if (ModelState.IsValid)
            {
                _context.Add(salaryPayment);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["EmployeeId"] = new SelectList(_context.Employee, "Id", "Id", salaryPayment.EmployeeId);
            return(View(salaryPayment));
        }
예제 #4
0
        public async Task <IActionResult> Create([Bind("Id,Name,CompanyId,Phone,SalaryPerAnnum,TaxCode")] Employee employee)
        {
            if (ModelState.IsValid)
            {
                _context.Add(employee);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CompanyId"] = new SelectList(_context.Company, "Id", "Id", employee.CompanyId);
            return(View(employee));
        }