public List<Location> ListLocations() { using (WorkScheduleContext context = new WorkScheduleContext()) { return context.Locations.ToList(); } }
public void AddNewLocation(Location item) { using (var context = new WorkScheduleContext()) { // Get the new stuff var added = context.Locations.Add(item); context.SaveChanges(); } }
public void UpdateLocation(Location item) { using (var context = new WorkScheduleContext()) { // Edit current location var attached = context.Locations.Attach(item); var existing = context.Entry<Location>(attached); existing.State = System.Data.Entity.EntityState.Modified; context.SaveChanges(); } }
public List<EmployeeSkillPOCO> GetReportEmployeeSkill() { using (var context = new WorkScheduleContext()) { var results = from row in context.EmployeeSkills orderby row.Skill.Description select new EmployeeSkillPOCO() { Description = row.Skill.Description, Name = row.Employee.FirstName + " " + row.Employee.LastName, Phone = row.Employee.HomePhone, Level = row.Level.ToString(), YearsExperience = row.YearsOfExperience }; return results.ToList(); } }