public virtual ActionResult AddOrUpdate(SpecialEducationModel specialEducationModel)
 {
     try
     {
         if (!ModelState.IsValid)
         {
             return(Json(new { IsError = true, Message = "ورودی نا معتبر!" }));
         }
         var data = _baseInfoComissionCouncilService.AddOrUpdateSpecialEducation(specialEducationModel, specialEducationModel.Id != null && specialEducationModel.Id > 0 ? StateOperation.ویرایش : StateOperation.درج);
         return(Json(new { IsError = !data.Item1, Message = data.Item2 }));
     }
     catch (Exception ex)
     {
         return(Json(new { IsError = true, Message = "خطا در ثبت اطلاعات!" }));
     }
 }
 public Tuple <bool, string> AddOrUpdateSpecialEducation(SpecialEducationModel specialEducationModel, StateOperation stateOperation)
 {
     try
     {
         if (stateOperation == StateOperation.درج)
         {
             var specialEducation = _specialEducationRepository.Find(x => x.Name == specialEducationModel.Name);
             if (specialEducation != null)
             {
                 return(new Tuple <bool, string>(false, "خطا در انجام عملیات : نام مورد نظر تکراری می باشد"));
             }
             SpecialEducation newAuthentication = new SpecialEducation
             {
                 Name = specialEducationModel.Name
             };
             _specialEducationRepository.Add(newAuthentication);
         }
         else
         {
             if (_specialEducationRepository.Contains(x => x.Id != specialEducationModel.Id && x.Name == specialEducationModel.Name))
             {
                 return(new Tuple <bool, string>(false, "خطا در انجام عملیات : نام مورد نظر تکراری می باشد"));
             }
             var authentication = _specialEducationRepository.Find(x => x.Id == specialEducationModel.Id);
             if (authentication == null)
             {
                 return(new Tuple <bool, string>(false, "خطا در انجام عملیات : رکورد مورد نظر یافت نشد"));
             }
             authentication.Name = specialEducationModel.Name;
             _specialEducationRepository.Update(authentication);
         }
         _unitOfWork.SaveChanges();
         return(new Tuple <bool, string>(true, "عملیات ثبت شد"));
     }
     catch (Exception)
     {
         return(new Tuple <bool, string>(false, "خطا در انجام عملیات"));
     }
 }