コード例 #1
0
        public async Task CreateFuncionesRol(Roles model)
        {
            try
            {
                foreach (var f in model.Funciones)
                {
                    try
                    {
                        FuncionesRol fr = new FuncionesRol();

                        fr.IdRol     = model.RolId;
                        fr.IdFuncion = f.IdFuncion;
                        fr.Estado    = 1;

                        _db.dbSetFuncionesRol.Add(fr);
                        await _db.SaveChangesAsync();
                    }
                    catch (Exception e)
                    {
                    }
                }
            }
            catch (Exception e)
            {
                throw new Exception(e.Message, e);
            }
        }
コード例 #2
0
        public async Task Update(FuncionesRol model)
        {
            try
            {
                var _model = await _db.dbSetFuncionesRol.FirstOrDefaultAsync(e => e.FuncionesRolId == model.FuncionesRolId);

                if (_model != null)
                {
                    _db.Entry(_model).CurrentValues.SetValues(model);
                    await _db.SaveChangesAsync();
                }
            }
            catch (Exception e)
            {
                throw new Exception(e.Message, e);
            }
        }
コード例 #3
0
        public async Task UpdateEstado(FuncionesRol obj)
        {
            try
            {
                var _obj = await _db.dbSetFuncionesRol.FirstOrDefaultAsync(e => e.FuncionesRolId == obj.FuncionesRolId);

                if (_obj != null)
                {
                    _obj.Estado = obj.Estado;

                    await _db.SaveChangesAsync();
                }
            }
            catch (Exception e)
            {
                throw new Exception(e.Message, e);
            }
        }
コード例 #4
0
                                                          public async Task <IHttpActionResult> UpdateEstado(FuncionesRol 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)); }
                                                          }