Beispiel #1
0
 public void AddChair(Chair c)
 {
     using (var context = new SittingPlanContext())
     {
         context.Chairs.Add(c);
         context.SaveChanges();
     };
 }
Beispiel #2
0
 public void AddPerson(Person p)
 {
     using (var context = new SittingPlanContext())
     {
         context.People.Add(p);
         context.SaveChanges();
     }
 }
Beispiel #3
0
 public void AddDesk(Desk d)
 {
     using (var context = new SittingPlanContext())
     {
         context.Desk.Add(d);
         context.SaveChanges();
     };
 }
Beispiel #4
0
 public void removePersontoChair(int chairid)
 {
     using (var context = new SittingPlanContext())
     {
         var chair = context.Chairs.Find(chairid);
         chair.PersonId = null;
         chair.Person   = null;
         context.SaveChanges();
     }
 }
Beispiel #5
0
 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();
     }
 }
Beispiel #6
0
        public void AddEmptyChair(int deskId)
        {
            var chair = new Chair();

            chair.DeskId = deskId;
            using (var context = new SittingPlanContext())
            {
                context.Chairs.Add(chair);
                context.SaveChanges();
            }
        }
Beispiel #7
0
        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();
            }
        }
Beispiel #9
0
        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();
            }
        }
Beispiel #10
0
        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();
            }
        }