public void AddChair(Chair c) { using (var context = new SittingPlanContext()) { context.Chairs.Add(c); context.SaveChanges(); }; }
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 removePersontoChair(int chairid) { using (var context = new SittingPlanContext()) { var chair = context.Chairs.Find(chairid); chair.PersonId = null; chair.Person = null; context.SaveChanges(); } }
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(); } }