public SaveCentroResponse SaveCentro(int idCentro, string centro, string ciudad, string pais) { var response = new SaveCentroResponse(); try { var centroGuardar = _candidatoCentroRepository.GetOne(x => x.CandidatoCentroEducativoId == idCentro && x.IsActivo); if (centroGuardar == null) { CandidatoCentroEducativo nuevoCentro = new CandidatoCentroEducativo() { Centro = centro, Ciudad = ciudad, Pais = pais, IsActivo = true }; _candidatoCentroRepository.Create(nuevoCentro); } else { centroGuardar.Centro = centro; centroGuardar.Ciudad = ciudad; centroGuardar.Pais = pais; _candidatoCentroRepository.Update(centroGuardar); } response.IsValid = true; } catch (Exception ex) { response.IsValid = false; response.ErrorMessage = ex.Message; } return(response); }
private static CandidatoCentroEducativoRowViweModel ConvertToCentroRowViewModel(this CandidatoCentroEducativo centro) { var centroRowViewModel = new CandidatoCentroEducativoRowViweModel() { CentroId = centro.CandidatoCentroEducativoId, Centro = centro.Centro, Ciudad = centro.Ciudad, Pais = centro.Pais }; return(centroRowViewModel); }