protected void getEmployeeList() { using (DefaultConnectionEF conn = new DefaultConnectionEF()) { var employees = from e in conn.AspNetUsers select e; GrdEmployee.DataSource = employees.ToList(); GrdEmployee.DataBind(); } }
protected void Button3_Click(object sender, EventArgs e) { string userId = User.Identity.GetUserId(); using (DefaultConnectionEF conn = new DefaultConnectionEF()) { WorkHour clock = new WorkHour(); clock.ClockIn = clockInDateTime; clock.ClockOut = clockOutDateTime; clock.TimeWorked = Convert.ToInt32((clockOutDateTime - clockInDateTime).TotalMinutes); clock.Employee = userId; conn.WorkHours.AddOrUpdate(clock); conn.SaveChanges(); Response.Redirect("Employees.aspx"); } Label3.Text = "Your hours have been submitted"; }