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; } } }
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); } } }
public async Task Post([FromBody] RolPermisoModelo rolPermisoModelo) { await _rolPermisodata.Insert(rolPermisoModelo); }