コード例 #1
0
        public List <Staff> GetAllStaffs()
        {
            var context = new WCFServicesContext();
            var staffs  = context.Staffs.ToList();

            context.Dispose();
            return(staffs);
        }
コード例 #2
0
        public Staff GetStaffById(int id)
        {
            var context = new WCFServicesContext();
            var staff   = context.Staffs.SingleOrDefault(c => c.Id == id);

            context.Dispose();
            return(staff);
        }
コード例 #3
0
        public Staff AddStaff(Staff staff)
        {
            var context = new WCFServicesContext();

            context.Staffs.Add(staff);
            context.SaveChanges();
            context.Dispose();
            return(staff);
        }