public void AddPerson(Person p) { using (var context = new SittingPlanContext()) { context.People.Add(p); context.SaveChanges(); } }
public void AddDesk(Desk d) { using (var context = new SittingPlanContext()) { context.Desk.Add(d); context.SaveChanges(); }; }
public void AddChair(Chair c) { using (var context = new SittingPlanContext()) { context.Chairs.Add(c); context.SaveChanges(); }; }
public List <Floor> GetPlan() { var floors = new List <Floor>(); using (var Context = new SittingPlanContext()) { floors = Context.Floors.Include(p => p.Desks.Select(x => x.Chairs.Select(y => y.Person))).ToList(); } return(floors); }
public List <Floor> GetAll() { var floors = new List <Floor>(); using (var Context = new SittingPlanContext()) { floors = Context.Floors.Where(p => p.Id > 0).OrderBy(p => p.Id).ToList(); } return(floors); }
public List <Desk> GetAll() { var desks = new List <Desk>(); using (var sittingPlanContext = new SittingPlanContext()) { desks = sittingPlanContext.Desk.Where(p => p.Id > 0).OrderBy(p => p.Name).ToList(); } return(desks); }
public List <Chair> GetAll() { var chairs = new List <Chair>(); using (var context = new SittingPlanContext()) { chairs = context.Chairs.Where(x => x.Id > 0).Include(p => p.Person).OrderBy(x => x.Person.Id).ToList(); } return(chairs); }
public List <Chair> GetChairs(int deskid) { var chairs = new List <Chair>(); using (var context = new SittingPlanContext()) { chairs = context.Chairs.Where(p => p.DeskId == deskid).Include(p => p.Person).OrderBy(p => p.Id).ToList(); } return(chairs); }
public List <Person> GetAll() { var people = new List <Person>(); using (var sittingPlanContext = new SittingPlanContext()) { people = sittingPlanContext.People.Where(p => p.Id > 0).OrderBy(p => p.Name).ToList(); } return(people); }
public void removePersontoChair(int chairid) { using (var context = new SittingPlanContext()) { var chair = context.Chairs.Find(chairid); chair.PersonId = null; chair.Person = null; context.SaveChanges(); } }
public List <Person> GetNotSittingPeople() { var people = new List <Person>(); using (var context = new SittingPlanContext()) { string query = "SELECT* FROM People P WHERE Id NOT IN(SELECT PersonId FROM Chairs C WHERE C.PersonId = P.Id)"; people = context.Database.SqlQuery <Person>(query).ToList(); } return(people); }
public void addPersontoChair(int personid, int chairid) { using (var context = new SittingPlanContext()) { var chair = context.Chairs.Find(chairid); var person = context.People.Find(personid); chair.PersonId = personid; chair.Person = person; context.SaveChanges(); } }
public void AddEmptyChair(int deskId) { var chair = new Chair(); chair.DeskId = deskId; using (var context = new SittingPlanContext()) { context.Chairs.Add(chair); context.SaveChanges(); } }
public List <Person> AddPersonwithList(Person p) { var people = new List <Person>(); using (var personContext = new SittingPlanContext()) { personContext.People.Add(p); personContext.SaveChanges(); people = personContext.People.Where(x => x.Id > 0).OrderBy(x => x.Name).ToList(); } return(people); }
public void AddFloor(string name) { var floor = new Floor() { Name = name }; using (var context = new SittingPlanContext()) { context.Floors.Add(floor); context.SaveChanges(); } }
public void AddDesk(string name, int floorid) { var desk = new Desk(); desk.Name = name; desk.FloorId = floorid; var floor = new Floor(); using (var context = new SittingPlanContext()) { context.Desk.Add(desk); context.SaveChanges(); } }
public void AddPerson(string name, string surname, string mail) { var p = new Person() { Name = name, Surname = surname, Mail = mail }; using (var context = new SittingPlanContext()) { context.People.Add(p); context.SaveChanges(); } }