Example #1
0
        public IEnumerable <Room> List()
        {
            var          db    = new VetDbContext();
            IList <Room> rooms = db.Rooms.ToList();

            return(rooms);
        }
Example #2
0
        public void Update(Room entity)
        {
            var db = new VetDbContext();

            db.Entry(entity).State = EntityState.Modified;
            db.SaveChanges();
        }
Example #3
0
        public Room GetById(int id)
        {
            var db   = new VetDbContext();
            var room = db.Rooms.Find(id);

            return(room);
        }
Example #4
0
        public IEnumerable <Doctor> List()
        {
            var            db      = new VetDbContext();
            IList <Doctor> doctors = db.Doctors.ToList();

            return(doctors);
        }
Example #5
0
        public IEnumerable <Room> GetByFilters(Room entity)
        {
            var db    = new VetDbContext();
            var rooms = db.Rooms.Where(x => x.Location == entity.Location && x.Name == entity.Name).ToList();

            return(rooms);
        }
Example #6
0
        public Doctor GetById(int id)
        {
            var db     = new VetDbContext();
            var doctor = db.Doctors.Find(id);

            return(doctor);
        }
Example #7
0
        public IEnumerable <Doctor> GetByFilters(Doctor entity)
        {
            var db      = new VetDbContext();
            var doctors = db.Doctors.Where(x => x.DNI == entity.DNI && x.Enrollment == entity.Enrollment).ToList();

            return(doctors);
        }
Example #8
0
        public Room Insert(Room entity)
        {
            var db = new VetDbContext();

            db.Rooms.Add(entity);
            db.SaveChanges();
            return(entity);
        }
Example #9
0
        public void Delete(int id)
        {
            var db   = new VetDbContext();
            var room = db.Rooms.Find(id);

            db.Rooms.Remove(room);
            db.SaveChanges();
        }
Example #10
0
        public Doctor Insert(Doctor entity)
        {
            var db = new VetDbContext();

            db.Doctors.Add(entity);
            db.SaveChanges();
            return(entity);
        }
Example #11
0
        public void Delete(int id)
        {
            var db     = new VetDbContext();
            var doctor = db.Doctors.Find(id);

            db.Doctors.Remove(doctor);
            db.SaveChanges();
        }