Exemple #1
0
        public async Task Insert(RolPermisoModelo rolpermisoModelo)
        {
            using (SqlConnection sql = new SqlConnection(_connectionString))
            {
                using (SqlCommand cmd = new SqlCommand("PA_Insertar_RolPermiso", sql))
                {
                    cmd.CommandType = System.Data.CommandType.StoredProcedure;
                    cmd.Parameters.Add(new SqlParameter("@S_id_rol", rolpermisoModelo.S_id_rol));
                    cmd.Parameters.Add(new SqlParameter("@S_id_permiso", rolpermisoModelo.S_id_permiso));
                    await sql.OpenAsync();

                    await cmd.ExecuteNonQueryAsync();

                    return;
                }
            }
        }
Exemple #2
0
        public async Task <RolPermisoModelo> GetById(int Id)
        {
            using (SqlConnection sql = new SqlConnection(_connectionString))
            {
                using (SqlCommand cmd = new SqlCommand("PA_obtener_rolPermiso_por_id", sql))
                {
                    cmd.CommandType = System.Data.CommandType.StoredProcedure;
                    cmd.Parameters.Add(new SqlParameter("@Id", Id));
                    RolPermisoModelo response = null;
                    await sql.OpenAsync();

                    using (var reader = await cmd.ExecuteReaderAsync())
                    {
                        while (await reader.ReadAsync())
                        {
                            response = MapToRolPermiso(reader);
                        }
                    }

                    return(response);
                }
            }
        }
Exemple #3
0
 public async Task Post([FromBody] RolPermisoModelo rolPermisoModelo)
 {
     await _rolPermisodata.Insert(rolPermisoModelo);
 }