public async Task Create(NivelCompetenciaTecnica model)
 {
     try
     {
         _db.nivelCompetenciaTecnica.Add(model);
         await _db.SaveChangesAsync();
     }
     catch (Exception e)
     {
         throw new Exception(e.Message, e);
     }
 }
        public async Task UpdateEstado(NivelCompetenciaTecnica obj)
        {
            try
            {
                var _obj = await _db.nivelCompetenciaTecnica.FirstOrDefaultAsync(e => e.NivelCompetenciaId == obj.NivelCompetenciaId);

                if (_obj != null)
                {
                    _obj.Estado = obj.Estado;
                    await _db.SaveChangesAsync();
                }
            }
            catch (Exception e)
            {
                throw new Exception(e.Message, e);
            }
        }
        public async Task Update(NivelCompetenciaTecnica model)
        {
            try
            {
                var _model = await _db.nivelCompetenciaTecnica.FirstOrDefaultAsync(e => e.NivelCompetenciaId == model.NivelCompetenciaId);

                if (_model != null)
                {
                    _db.Entry(_model).CurrentValues.SetValues(model);
                    await _db.SaveChangesAsync();
                }
            }
            catch (Exception e)
            {
                throw new Exception(e.Message, e);
            }
        }
                                                                     public async Task <IHttpActionResult> UpdateEstado(NivelCompetenciaTecnica obj)
                                                                     {
                                                                         try { log.Info(new MDCSet(this.ControllerContext.RouteData));
                                                                               await _repository.UpdateEstado(obj);

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

                                                                                               return(InternalServerError(e)); }
                                                                     }
                                                                     [HttpPost][Authorize] public async Task <IHttpActionResult> Create(NivelCompetenciaTecnica obj)
                                                                     {
                                                                         try { log.Info(new MDCSet(this.ControllerContext.RouteData));
                                                                               await _repository.Create(obj);

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