Esempio n. 1
0
        public async Task <ActionResult> Create([Bind(Include = "Id,Year,Version,GrossIncomeBase,GrossIncomeTop,TaxRate1,TaxBase")] TaxRate taxRate)
        {
            if (ModelState.IsValid)
            {
                taxRate.CreationDateTime = DateTimeOffset.UtcNow;
                db.TaxRates.Add(taxRate);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            return(View(taxRate));
        }
Esempio n. 2
0
        public async Task <ActionResult> Create([Bind(Include = "Id,Name,LastName,StartDate")] Employee employee)
        {
            if (ModelState.IsValid)
            {
                employee.CreationDateTime = DateTimeOffset.UtcNow;
                db.Employees.Add(employee);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            return(View(employee));
        }
        public async Task <ActionResult> Create([Bind(Include = "Id,EmployeeId,AnnualSalary,StartDate,SuperRate")] EmployeeIncome employeeIncome)
        {
            if (ModelState.IsValid)
            {
                employeeIncome.CreationDateTime = DateTimeOffset.UtcNow;
                db.EmployeeIncomes.Add(employeeIncome);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            ViewBag.EmployeeId = new SelectList(db.Employees, "Id", "Name", employeeIncome.EmployeeId);
            return(View(employeeIncome));
        }