private int Add(ProfessorSyncModel model, ITermRepository termRepo) { var p = new Professor { Term = termRepo.GetMany(x => x.TermCode == model.Term).FirstOrDefault(), IsActive = model.IsActive, UniversityWorkPlace = model.UniversityWorkPlace, UniversityStudyPlace = model.UniversityStudyPlace, AcademicDegree = model.AcademicDegree, TeachingExperience = model.TeachingExperience, ScientificRank = model.ScientificRank, Email = model.Email, Mobile = model.Mobile, NationalCode = model.NationalCode, Gender = model.Gender, Family = model.Family, Name = model.Name, Status = model.Status, ProfessorCode = model.ProfessoreCode, CreationDate = DateTime.Now }; DataContext.Professors.Add(p); return(DataContext.SaveChanges()); }