public async Task <IActionResult> Create([Bind("ID,FirstName,LastName,DisplayName")] Employee employee) { if (ModelState.IsValid) { _context.Add(employee); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(employee)); }
public async Task <IActionResult> Create(int id, DateTime timeIn, DateTime timeOut, int employeeId) { TimeSheet timeSheet = new TimeSheet { ID = id, TimeIn = timeIn, TimeOut = timeOut, HoursWorked = timeOut - timeIn, EmployeeID = employeeId }; if (ModelState.IsValid) { _context.Add(timeSheet); await _context.SaveChangesAsync(); return(Redirect($"Details/{timeSheet.ID}")); } ViewData["EmployeeID"] = new SelectList(_context.Employees, "ID", "DisplayName", timeSheet.EmployeeID); return(View(timeSheet)); }
public void Insert(Employee E) { DbContext.Add(E); DbContext.SaveChanges(); }
public void Insert(Task T) { DbContext.Add(T); DbContext.SaveChanges(); }