async Task <WrapperSimpleTypesDTO> AsignarCategoriaRepresentante() { // Guardo la categoria que seleccione para guardar CategoriasRepresentantesDTO categoriaRepresentante = new CategoriasRepresentantesDTO { CodigoRepresentante = _persona.RepresentanteDeLaPersona.Consecutivo, CodigoCategoria = _categoriaSeleccionada.CodigoCategoria, }; WrapperSimpleTypesDTO wrapper = null; if (!EsRegistroCategoria) { // Jalo el codigo de categoria que estoy viendo, no la que estoy seleccionando categoriaRepresentante.Consecutivo = _categoriaParaVer.CodigoCategoriaPerfil; if (IsNotConnected) { return(null); } wrapper = await _categoriaService.ModificarCategoriaRepresentante(categoriaRepresentante); } else { if (IsNotConnected) { return(null); } wrapper = await _categoriaService.CrearCategoriaRepresentante(categoriaRepresentante); } return(wrapper); }
public async Task <CategoriasRepresentantesDTO> BuscarCategoriaRepresentantePorConsecutivoAndIdioma(CategoriasRepresentantes categoriaRepresentantesParaBuscar) { IQueryable <CategoriasRepresentantes> queryRepresentante = _context.CategoriasRepresentantes.Where(x => x.Consecutivo == categoriaRepresentantesParaBuscar.Consecutivo).AsQueryable(); CategoriasRepresentantesDTO categoriaRepresentanteBuscada = await queryRepresentante .Select(x => new CategoriasRepresentantesDTO { Consecutivo = x.Consecutivo, CodigoCategoria = x.CodigoCategoria, CodigoRepresentante = x.CodigoRepresentante, Categorias = new CategoriasDTO { Consecutivo = x.Categorias.Consecutivo, CodigoArchivo = x.Categorias.CodigoArchivo, DescripcionIdiomaBuscado = x.Categorias.CategoriasContenidos.Where(y => y.CodigoIdioma == categoriaRepresentantesParaBuscar.CodigoIdiomaUsuarioBase).Select(y => y.Descripcion).FirstOrDefault(), CategoriasContenidos = x.Categorias.CategoriasContenidos.Where(y => y.CodigoIdioma == categoriaRepresentantesParaBuscar.CodigoIdiomaUsuarioBase) .Select(z => new CategoriasContenidosDTO { Consecutivo = z.Consecutivo, Descripcion = z.Descripcion, CodigoIdioma = z.CodigoIdioma }).ToList() } }) .AsNoTracking() .FirstOrDefaultAsync(); return(categoriaRepresentanteBuscada); }
void AdicionarCategoriaSeleccionadaEnEntidad(int consecutivoCreado = 0) { switch (_persona.TipoPerfil) { case TipoPerfil.Candidato: CategoriasCandidatosDTO categoriaCandidato = new CategoriasCandidatosDTO { Consecutivo = consecutivoCreado, CodigoCategoria = _categoriaSeleccionada.CodigoCategoria, CodigoCandidato = _persona.CandidatoDeLaPersona.Consecutivo, PosicionCampo = _categoriaSeleccionada.PosicionJugador, HabilidadesCandidatos = _habilidadesCandidato.Where(x => x.Habilidades.CodigoCategoria == _categoriaSeleccionada.CodigoCategoria).ToList(), Categorias = new CategoriasDTO { CodigoArchivo = _categoriaSeleccionada.CodigoArchivo } }; _persona.CandidatoDeLaPersona.CategoriasCandidatos.Add(categoriaCandidato); break; case TipoPerfil.Grupo: CategoriasGruposDTO categoriaGrupo = new CategoriasGruposDTO { Consecutivo = consecutivoCreado, CodigoCategoria = _categoriaSeleccionada.CodigoCategoria, CodigoGrupo = _persona.GrupoDeLaPersona.Consecutivo, Categorias = new CategoriasDTO { CodigoArchivo = _categoriaSeleccionada.CodigoArchivo } }; _persona.GrupoDeLaPersona.CategoriasGrupos.Add(categoriaGrupo); break; case TipoPerfil.Representante: CategoriasRepresentantesDTO categoriaRepresentante = new CategoriasRepresentantesDTO { Consecutivo = consecutivoCreado, CodigoCategoria = _categoriaSeleccionada.CodigoCategoria, CodigoRepresentante = _persona.RepresentanteDeLaPersona.Consecutivo, Categorias = new CategoriasDTO { CodigoArchivo = _categoriaSeleccionada.CodigoArchivo } }; _persona.RepresentanteDeLaPersona.CategoriasRepresentantes.Add(categoriaRepresentante); break; } }
public async Task <CategoriasRepresentantesDTO> BuscarCategoriaRepresentantePorConsecutivoAndIdioma(CategoriasRepresentantes categoriaRepresentantesParaBuscar) { using (SportsGoEntities context = new SportsGoEntities(false)) { CategoriasRepository categoriasRepo = new CategoriasRepository(context); CategoriasRepresentantesDTO categoriaRepresentanteBuscada = await categoriasRepo.BuscarCategoriaRepresentantePorConsecutivoAndIdioma(categoriaRepresentantesParaBuscar); return(categoriaRepresentanteBuscada); } }
async Task <WrapperSimpleTypesDTO> BorrarCategoriaRepresentante() { CategoriasRepresentantesDTO categoriaRepresentante = new CategoriasRepresentantesDTO { Consecutivo = _categoriaParaVer.CodigoCategoriaPerfil }; if (IsNotConnected) { return(null); } WrapperSimpleTypesDTO wrapper = await _categoriaService.EliminarCategoriaRepresentante(categoriaRepresentante); return(wrapper); }
public async Task <WrapperSimpleTypesDTO> EliminarCategoriaRepresentante(CategoriasRepresentantesDTO categoriaRepresanteParaBorrar) { if (categoriaRepresanteParaBorrar == null) { throw new ArgumentNullException("No puedes eliminar una categoriaRepresentante si categoriaRepresanteParaBorrar es nula!."); } if (categoriaRepresanteParaBorrar.Consecutivo <= 0) { throw new ArgumentException("categoriaRepresanteParaBorrar vacio y/o invalido!."); } IHttpClient client = ConfigurarHttpClient(); WrapperSimpleTypesDTO wrapperEliminarCategoriaRepresentante = await client.PostAsync <CategoriasRepresentantesDTO, WrapperSimpleTypesDTO>("Categorias/EliminarCategoriaRepresentante", categoriaRepresanteParaBorrar); return(wrapperEliminarCategoriaRepresentante); }
public async Task <CategoriasRepresentantesDTO> BuscarCategoriaRepresentantePorConsecutivoAndIdioma(CategoriasRepresentantesDTO categoriaRepresentantesParaBuscar) { if (categoriaRepresentantesParaBuscar == null) { throw new ArgumentNullException("No puedes buscar una categoriaRepresentante si categoriaRepresentantesParaBuscar es nulo!."); } if (categoriaRepresentantesParaBuscar.Consecutivo <= 0 || categoriaRepresentantesParaBuscar.IdiomaBase == Idioma.SinIdioma) { throw new ArgumentException("categoriaRepresentantesParaBuscar vacio y/o invalido!."); } IHttpClient client = ConfigurarHttpClient(); CategoriasRepresentantesDTO categoriaEventoBuscada = await client.PostAsync("Categorias/BuscarCategoriaRepresentantePorConsecutivoAndIdioma", categoriaRepresentantesParaBuscar); return(categoriaEventoBuscada); }
public async Task <WrapperSimpleTypesDTO> CrearCategoriaRepresentante(CategoriasRepresentantesDTO categoriaRepresentanteParaCrear) { if (categoriaRepresentanteParaCrear == null) { throw new ArgumentNullException("No puedes crear una categoriaRepresentante si categoriaRepresentanteParaCrear es nula!."); } if (categoriaRepresentanteParaCrear.CodigoCategoria > 0 || categoriaRepresentanteParaCrear.CodigoRepresentante > 0) { throw new ArgumentException("categoriaRepresentanteParaCrear vacia y/o invalida!."); } IHttpClient client = ConfigurarHttpClient(); WrapperSimpleTypesDTO wrapperCrearCategoriaRepresentante = await client.PostAsync <CategoriasRepresentantesDTO, WrapperSimpleTypesDTO>("Categorias/CrearCategoriaRepresentante", categoriaRepresentanteParaCrear); return(wrapperCrearCategoriaRepresentante); }
public async Task <IHttpActionResult> BuscarCategoriaRepresentantePorConsecutivoAndIdioma(CategoriasRepresentantes categoriaRepresentantesParaBuscar) { if (categoriaRepresentantesParaBuscar == null || categoriaRepresentantesParaBuscar.Consecutivo <= 0 || categoriaRepresentantesParaBuscar.IdiomaBase == Idioma.SinIdioma) { return(BadRequest("categoriaRepresentantesParaBuscar vacio y/o invalido!.")); } try { CategoriasRepresentantesDTO categoriaEventoBuscada = await _categoriasBusiness.BuscarCategoriaRepresentantePorConsecutivoAndIdioma(categoriaRepresentantesParaBuscar); return(Ok(categoriaEventoBuscada)); } catch (Exception ex) { return(InternalServerError(ex)); } }
public async Task <JsonResult> DeleteAgentSkills(CategoriasRepresentantesDTO category) { Result <WrapperSimpleTypesDTO> result = new Result <WrapperSimpleTypesDTO>(); try { CategoriasServices categoryService = new CategoriasServices(); result.obj = await categoryService.EliminarCategoriaRepresentante(category); if (result.obj == null) { return(Json(Helper.returnErrorSaveObj(UserLoggedIn().PersonaDelUsuario.CodigoIdioma), JsonRequestBehavior.AllowGet)); } return(Json(result, JsonRequestBehavior.AllowGet)); } catch (Exception) { return(Json(Helper.returnErrorSaveObj(UserLoggedIn().PersonaDelUsuario.CodigoIdioma), JsonRequestBehavior.AllowGet)); } }
void RemoverCategoriaParaVerDeEntidad() { switch (_persona.TipoPerfil) { case TipoPerfil.Candidato: CategoriasCandidatosDTO categoriaCandidato = _persona.CandidatoDeLaPersona.CategoriasCandidatos.Where(x => x.CodigoCategoria == _categoriaParaVer.CodigoCategoria).FirstOrDefault(); _persona.CandidatoDeLaPersona.CategoriasCandidatos.Remove(categoriaCandidato); break; case TipoPerfil.Grupo: CategoriasGruposDTO categoriaGrupo = _persona.GrupoDeLaPersona.CategoriasGrupos.Where(x => x.CodigoCategoria == _categoriaParaVer.CodigoCategoria).FirstOrDefault(); _persona.GrupoDeLaPersona.CategoriasGrupos.Remove(categoriaGrupo); break; case TipoPerfil.Representante: CategoriasRepresentantesDTO categoriaRepresentante = _persona.RepresentanteDeLaPersona.CategoriasRepresentantes.Where(x => x.CodigoCategoria == _categoriaParaVer.CodigoCategoria).FirstOrDefault(); _persona.RepresentanteDeLaPersona.CategoriasRepresentantes.Remove(categoriaRepresentante); break; } }
public async Task <List <CategoriasRepresentantesDTO> > ListarCategoriasDeUnRepresentante(CategoriasRepresentantesDTO categoriaRepresentanteParaListar) { if (categoriaRepresentanteParaListar == null) { throw new ArgumentNullException("No puedes buscar una categoriaRepresentante si categoriaRepresentanteParaListar es nulo!."); } if (categoriaRepresentanteParaListar.CodigoRepresentante <= 0 || categoriaRepresentanteParaListar.IdiomaBase == Idioma.SinIdioma) { throw new ArgumentException("categoriaRepresentanteParaListar vacio y/o invalido!."); } IHttpClient client = ConfigurarHttpClient(); List <CategoriasRepresentantesDTO> listaCategoriasRepresentantes = await client.PostAsync <CategoriasRepresentantesDTO, List <CategoriasRepresentantesDTO> >("Categorias/ListarCategoriasDeUnRepresentante", categoriaRepresentanteParaListar); return(listaCategoriasRepresentantes); }
public CategoriasModel(CategoriasRepresentantesDTO categoriaRepresentante) : this(categoriaRepresentante.CodigoCategoria, categoriaRepresentante.Consecutivo, categoriaRepresentante.Categorias.CodigoArchivo, categoriaRepresentante.Categorias.DescripcionIdiomaBuscado, categoriaRepresentante.Categorias.UrlArchivo) { }