public async Task <IActionResult> Create([Bind("Id,Fullname,Email,Gender,Birthdate")] Employee employee) { if (ModelState.IsValid) { _context.Add(employee); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(employee)); }
public async Task <IActionResult> Create([Bind("Id,Type,Allowance")] Vacation vacation) { if (ModelState.IsValid) { _context.Add(vacation); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(vacation)); }
public async Task <IActionResult> Create([Bind("Id,StartDate,EndDate,EmployeeId,VacationId")] Employee_Vacation_Request employee_Vacation_Request) { if (ModelState.IsValid) { _context.Add(employee_Vacation_Request); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["EmployeeId"] = new SelectList(_context.Employee, "Id", "Fullname", employee_Vacation_Request.EmployeeId); ViewData["VacationId"] = new SelectList(_context.Vacation, "Id", "Type", employee_Vacation_Request.VacationId); return(View(employee_Vacation_Request)); }