public ActionResult <BaseViewModel> SetRelateFromStaffToClass(AddRelateFromStaffToClassViewModel model)
        {
            BaseViewModel baseViewModel = new BaseViewModel();

            _facultystaffService.AddRelateToClass(model);

            baseViewModel.Message      = "添加成功";
            baseViewModel.ResponseCode = 200;
            return(baseViewModel);
        }
        public bool isRepeat(AddRelateFromStaffToClassViewModel model)
        {
            var result = DbSet.FirstOrDefault(a => a.ClassCode == model.ClassCode && a.facultystaff_InfoId == model.facultystaff_InfoId &&
                                              a.Class_InfoId == model.Class_InfoId);

            if (result == null)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        public void AddRelateToClass(AddRelateFromStaffToClassViewModel model)
        {
            bool isrepeat = staffClassRelateRepository.isRepeat(model);

            if (!isrepeat)
            {
                return;
            }

            var insert = _IMapper.Map <AddRelateFromStaffToClassViewModel, ClassManager_Relate>(model);

            staffClassRelateRepository.Add(insert);
            staffClassRelateRepository.SaveChanges();
        }