public async Task Create(ListadoEmpleadosSind model)
 {
     try
     {
         _db.listadoEmpleadosSind.Add(model);
         await _db.SaveChangesAsync();
     }
     catch (Exception e)
     {
         throw new Exception(e.Message, e);
     }
 }
Esempio n. 2
0
        [HttpPost][Authorize] public async Task <IHttpActionResult> Create(ListadoEmpleadosSind datos)
        {
            try
            {
                log.Info(new MDCSet(this.ControllerContext.RouteData));
                await _repository.Create(datos);

                return(Ok("Nivel de competencia asignado correctamente a la categoría"));
            }
            catch (Exception e)
            {
                log.Error(new MDCSet(this.ControllerContext.RouteData), e);

                return(InternalServerError(e));
            }
        }
Esempio n. 3
0
        public async Task <IHttpActionResult> Update(ListadoEmpleadosSind datos)
        {
            try
            {
                log.Info(new MDCSet(this.ControllerContext.RouteData));
                await _repository.Update(datos);

                return(Ok("Nivel de competencia actualizado correctamente!"));
            }
            catch (Exception e)
            {
                log.Error(new MDCSet(this.ControllerContext.RouteData), e);

                return(InternalServerError(e));
            }
        }
        public async Task Update(ListadoEmpleadosSind model)
        {
            try
            {
                var _model = await _db.listadoEmpleadosSind.FirstOrDefaultAsync(e => e.Id == model.Id);

                if (_model != null)
                {
                    _db.Entry(_model).CurrentValues.SetValues(model);
                    await _db.SaveChangesAsync();
                }
            }
            catch (Exception e)
            {
                throw new Exception(e.Message, e);
            }
        }
        public async Task <IEnumerable <ListadoEmpleadosSind> > GetByCategoriaPeriodo(BusquedaNivel param)
        {
            try
            {
                ListaEmpleadosSindRepository repositorioListaSindicalizados = new ListaEmpleadosSindRepository();
                List <ListadoEmpleadosSind>  listaEmpleados = new List <ListadoEmpleadosSind>();

                var listaSindicalizados = await repositorioListaSindicalizados.GetAll();

                var entities = await _db.evaluacionesEmpleadosSind
                               .Where(e => e.CategoriaCompetenciaId == param.idCategoria)
                               .Where(e => e.Periodo == param.periodo)
                               .AsNoTracking().ToListAsync();


                foreach (var item in entities)
                {
                    foreach (var item2 in listaSindicalizados)
                    {
                        if (item.ListaEmpleadosId == item2.ListaId)
                        {
                            ListadoEmpleadosSind datos = new ListadoEmpleadosSind();
                            datos.NoEmpleado     = item2.NoEmpleado;
                            datos.NombreEmpleado = item2.NombreEmpleado;
                            listaEmpleados.Add(datos);
                        }
                    }
                }



                return(listaEmpleados.OrderBy(e => e.NombreEmpleado));
            }
            catch (Exception e)
            {
                throw new Exception(e.Message, e);
            }
        }